I need to test my vigorously tested code works when called by many threads
So I am calling the code in a loop in a TestMethod using TreadPool.QueueUserWorkItem
however there does not seem to be anyway of holding the current thread while all the threads kicked off are still running.
i.e. pretend code....
using Microsoft.VisualStudio.T...
I have a MySerialPort class/object accessed from FormGUI. After creating a MySerialPort object, I want to open it, and keep receiving data continuously. The data will be stored and managed in the object's data buffer. FormGUI's memoEdit will show the received codes from the MySerialPort object's buffer.
How can I use "new Thread()" with...
I have 2 threads, one that decodes bitmaps from the assetManager, and another that is my SurfaceView. When i set the priority of the bitmap decoder very low, i actually get more lag then if its much higher. Why would it act like that? thanks.
Heres my code:
public void bitmapLoader(final String filePath,final int pathVariable) ...
I'm using python right now. I have a thread that represents my entire program. I want to open another console window using os.system(xterm&) as a thread which works. The only thing is, is it possible to print to the new window while the other thread is printing to the older window?
import sys
import os
def my_fork():
child_pid ...
Calling Thread.join blocks the current (main) thread. However not calling join results in all spawned threads to be killed when the main thread exits. How does one spawn persistent children threads in Ruby without blocking the main thread?
Here's a typical use of join.
for i in 1..100 do
puts "Creating thread #{i}"
t = Thread.new(i...
Like blocks until the file is done playing, what's the principle and how to implement this?
...
I'm currently learning how to do multithreading in C++. One of my learning projects is a Tetris game. In this project I have a Game class that contains all game state data. It has methods for moving the block around and a few other things. This object will be accessed by the user (who will use the arrow keys to move the block, from the m...
I have a HTML table which I add items to from javascript on an ASP.NET callback when a button is clicked.
HTML:
<%@ Page Language="C#" CodeFile="Hello5.aspx.cs" Inherits="ClientCallback" %>
<html>
<head>
<script>
function AddResult()
{
GetResults("blah", "");
}
function UpdateTable(itemText)
{
var ...
Hello there,
I'm not sure if this is good programming etiquette, anyway I have a normal method in which I update certain bits of data and UI elements such as textblocks etc.
Anyway, I want to create a thread that every X amount of Seconds it runs the Update Method but I cannot access it because from what I understand a thread can only ...
I'm just trying to run a new thread each time a button click even occurs which should create a new form. I tried this in the button click event in the MainForm:
private void button1_Click(object sender, EventArgs e)
{
worker1 = new Thread(new ThreadStart(thread1));
worker2 = new Thread(new ThreadStart(thread2));
worker1.S...
Firstly, I use pthread library to write multithreading c program. Threads always hung by their waited mutexs. When I use the strace utility to find a thread is in FUTEX_WAIT status, I want to know which thread hold that mutex at the time. But I don't know how could I make it. Are there any utilities could do that?
Someone told me java v...
There is a collection and each element of that collection is sent to a function where 5 threads have to work on it.
How to make 5 threads work on the passed item?
foreach(var item in collection)
{
doSomeWork(item);
}
void doSomeWork(object item)
{
//here i have to do something with the passed 'item' by using 5 threads
}
...
I have a rather simple threading question.
I'm writing a simple utility that will run various SQL scripts based on parameters defined by the user.
In order to keep the UI responsive and provide feedback as to the status of the scripts that are being executed, I've decided that using ThreadPool.QueueUserWorkItem would be appropriate to ...
I'm new to multithreading in c# and am confused among all thread stuff.
here is what I'm trying to have:
public class TheClass
{
Thread _thread;
bool _isQuitting;
bool _isFinished;
object jobData;
public void Start()
{
jobData = new object();
_thread = new Thread(new ThreadStart(Run));
_th...
Hi,
I'm currently researching ways to hook a process and take control of it using mouse/keyboard events whilst it is in the background (Ala, not the active window). I guess you could think of it as a more advanced macro that doesn't require the targeted window/process to be active.
Now I know the process hooking code is abundantly well...
is a c++ member array of struct thread safe using only one index per thread ?
using the following class:
typedef struct {
bool bFlag;
unsigned int uiNum;
} TC_MYSTRUCT;
class MyClass {
public:
MyClass();
~MyClass();
int GetFreeIndex();
void SetIndexDataNum(int idx, int num);
int GetIndexDataNum(int idx);
pr...
hi this is my multi thread codes it works fine
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Threading;
namespace searchIpAdresses
{
public partial class frmSearchI...
Hi,
I'm making a cross plateform program that embbed a small RARP server (implemented with winpcap/pcap) and runs 2 TCP IP servers. I have to use C++.
So i will have at least 4 threads, the main one wich countain the controller, 2 TCP/IP async socket, and the RARP server.
I planned to use c++ BOOST Asio and Thread, because i need to r...
I've got an exam coming up soon. I've been looking through the past paper, this question keeps bugging me. I can't seem to find what the bug in the program could be because I'm quite new to all this. Can anyone help me out?
The following program contains a bug. Determine what kind of problem the program exhibits, and show how it can be...
I'm not sure how the internal thread handling of Parallel.foreach works and whether it can guarantee that a construct like this would work?
Parallel.Foreach(Connections, c =>
{
Input in = c.getInput();
while (in.hasNext()) {
object o = in.getNext();
dosomething(o);
}
}
);
where i...