Hi
The application I am working on uses thread pool. Here's the basic pseudo code.
On the main thread
foreach(Object obj in Component.GetObject())
{
//Invoke the thread pool providing the call back (method to be called on the background// thread) and pass the object as the parameter.
}
//Wait for the threads to complete.
The "Com...
Basically I need a replacement for Condition Variable and SleepConditionVariableCS because it only support Vista and UP. (For C++)
Some suggested to use Semaphore, I also found CreateEvent.
Basically, I need to have on thread waiting on WaitForSingleObject, until something one or more others thread tell me there is something to do.
In...
Hi,
I'm running a winservice that has 2 main objectives.
Execute/Handle exposed webmethods.
Run Inner processes that consume allot of CPU.
The problem is that when I execute many inner processes |(as tasks) that are queued to the threadpool or taskpool, the execution of the webmethods takes much more time as WCF also queues its exec...
I have some code that starts a couple of threads to let them execute, then uses a while loop to check for the current time passing a set timeout period, or for the correct number of results to have been processed (by checking an int on the class object) (with a Thread.Sleep() to wait between loops)
Once the while loop is set to exit, it...
I have a system which breaks a large taks into small tasks using about 30 threads as a time. As each individual thread finishes it persists its calculated results to the database. What I want to achieve is to have each thread pass its results to a new persisance class that will perform a type of double buffering and data persistance whil...
I want to pass a function that takes a parameter to the ThreadStart Constructor in C#. But, it seems that this is not possible, as I get a syntax error it I try to do something like this
Thread t1 = new Thread(new ThreadStart(func1(obj1));
where obj1 is an object of type List<string> (say).
If I want a thread to execute this function...
My C# application is such that a background worker is being used to wait for the acknowledgement of some transmitted data. Here is some psuedo code demonstrating what I'm trying to do:
UI_thread
{
TransmitData()
{
// load data for tx
// fire off TX background worker
}
RxSerialData()
{
// if received da...
Hi everyone. I will try my best to explain my problem and my line of thought on how I think I can solve it.
I use this code
for root, dirs, files in os.walk(downloaddir):
for infile in files:
f = open(os.path.join(root,infile),'rb')
filehash = hashlib.md5()
while True:
data = f.read(10240)
if len(data) =...
How can i efficiently display the status of a file when using a background thread?
For instance, lets say i have a 100MB file:
when i do the code below via a thread (just as an example) it runs in about 1 min:
foreach(byte b in file.bytes)
{
WriteByte(b, xxx);
}
But... if i want to update the user i have to use a delegate to upda...
I need to create multiple threads when a button is clicked and i've done that with this:
Dim myThread As New Threading.Thread(AddressOf getFile)
myThread.IsBackground = True
myThread.Start()
but i need to update a picture box with the downloaded file, buy if i set an event in the function getFile and raise it to notify that the files ...
How can I make a thread run only if the other thread is running too, meaning, if I return from run in one thread, then I want the other to stop running too,
my code looks something like this:
ClientMessageHandler clientMessagehandler = new ClientMessageHandler();
ServerMessageHandler serverMessagehandler = new ServerMessageHandle...
Hello !
I am really curious about how does the JVM work with threads !
In my searches in internet, I found some material about RTSJ, but I don't know if it's the right directions for my answers.
I also found this topic in sun's forums,
http://forums.sun.com/thread.jspa?forumID=513&threadID=472453,
but that's not satisfatory.
Can...
On .NET Framework 2.0 AutoResetEvent and ManualResetEvent inherit from EventWaitHandle. The EventWaitHandle class has 4 different constructors. 3 of the constructors support giving a name to the event. On the other hand both ManualResetEvent and AutoResetEvent do not support naming and provide a single constructor that receives the initi...
Hi,
I have written what I hope is a lightweight alternative to using the ManualResetEvent and AutoResetEvent classes in C#/.NET. The reasoning behind this was to have Event like functionality without the weight of using a kernel locking object.
Although the code seems to work well in both testing and production, getting this kind of th...
I am currently writing a multi-threaded C++ server using Poco and am now at the point where I need to be keeping information on which users are connected, how many connections each of them have, and given it is a proxy server, where each of those connections are proxying through to.
For this purpose I have created a ServerStats class wh...
I'm building a program in C++, using SDL, and am occasionally receiving this error:
* glibc detected * ./assistant: double free or corruption (!prev)
It's difficult to replicate, so I can't find exactly what's causing it, but I just added a second thread to the program, and neither thread run on its own seems to cause the error.
The t...
Hi
This is a question about best practices i guess but it applies directly to my current MT project.
I'm using WCF services to communicate with the server.
To do this i do the following:
services.MethodToCall(params);
and the asynch:
services.OnMethodToCallCompleted += delegate{
//do stuff and ting
};
This can lead to issue...
My particular scenario:
- Main thread starts a worker thread.
- Main thread needs to block itself until either worker thread is completed (yeah funny) or worker thread itself informs main thread to go on
Alright, so what I did in main thread:
wokerThread.Start(lockObj);
lock(lockObj)
Monitor.Wait(lockObj);
Somewhere in worker thread...
This sample code compares serial method with threaded method, on Quad core processor. The code just uses GetPixel() to read all pixels from 4 images.
I found that the speed up is around 65%, why it does not equal 75% as I have 4 cores and all of them are fully utilized?
P.S:
Can you check the code as I do not do any I/O, and no other p...
How do I call invokeLater or invokeAndWait in a BlackBerry / J2ME environment? I'm using RIM API 4.3. I know this is a basic question, but I can't find the method anywhere!
Thanks,
Dan
...