We have the following piece of code (idea for this code was found on this website) which will spawn new threads for the method "Do_SomeWork()". This enables us to run the method multiple times asynchronously.
The code is:
var numThreads = 20;
var toProcess = numThreads;
var resetEvent = new ManualResetEvent(false);
fo...
Hi Everyone,
I am again stuck with my webcrawler application (multi-threaded). It's been tested on my machine and our test machine and there's no problem (up to 15 hours of running), however on production use, it gives this type of error after 1 or 2 hours of running:
WebCrawler has encountered a problem and needs to close. We are s...
Whenever i am updating UI in windows form using delegate it gives me cross thread exception
why it is happening like this?
is there new thread started for each delegate call ?
void Port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
//this call delegate to display data
clsConnect(statusMsg);
}
protected ...
We have a situation where our application needs to process a series of files and rather than perform this function synchronously, we would like to employ multi-threading to have the workload split amongst different threads.
Each item of work is:
1. Open a file for read only
2. Process the data in the file
3. Write the processed data to ...
Hi,
I have an application (.Net 3.5) which creates threads to write something to the database so that the GUI does not block. All created threads are added to a list, so that I can wait (Thread.Join) for each thread when the application is closed (maybe not all threads are finished when the application is closed, so the app must wait fo...
I need a non-stripped version of libpthread.so for debugging. How can I compile it from source code? Host is Linux 2.6.
...
Hi
I have two threads, the main thread 'A' is responsible for message handling between a number of processes. When thread A gets a buffer full message, it should inform thread B and pass a pointer to the buffer which thread B will then process.
When thread B has finished it should inform thread A that it has finished.
How do I go abo...
Why we call the start() method ,which in turn calls the run() method ?
Can't we directly make a call to run() ?
Please give e.g if possible. ?
...
Hi,
I have a windows service that is reading data from a database and then submitting it to a WCF serivce. Once that has finished it is stamping a processed date on the original record.
Trouble I am currently having is to do with threading.
The call to the WCF serivce is relatively long and I want to have a number of concurrent calls ...
What's the cheapest way for a JavaScript like setTimeout-function in C++?
I would need this:
5000 miliseconds from now, start function xy (no parameters, no return value).
The reason for this is I need to initialize COM for text to speech, but when I do it on dll attach, it crashes.
It works fine however if I do not call CoInitialize...
What's the best way for loading a dll from a dll ?
My problem is I can't load a dll on process_attach, and I cannot load the dll from the main program, because I don't control the main program source. And therefore I cannot call a non-dllmain function, too.
...
I've been using the Semaphore class to create semaphores. However, the examples use managed code (requires /clr), and I need to use unmanaged code because it seems FreeType doesn't like working with managed code.
How can I create two simple threads which use a semaphore in unmanaged code?
...
Hello
I'm not able to understand the difference between Thread vs ThreadPool. Consider i've to manipulate 50,000 records using threads.
In case of threads i need to either predefine no of threads or no of records per threads. Either of them has to be constant.
In case of threadpool we dont need to set any of them theoretically. But pr...
I got a thread that is just banishing.. i'd like to know who is killing my thread and why.
It occurs to me my thread is being killed by the OS, but i'd like to confirm this and if possible to know why it's killing it.
As for the thread, i can assert it has at least 40 min of execution before dying, but it suddenly dies around 5 min...
I am running in a little bit of a trouble with boost threads ... I am using gdb with code::blocks and everytime I set a breakpoint in the thread code it breaks in the boost thread.hpp file, more exactly in this function (that probably launches the thread)
namespace boost
namespace detail
class thread_data:
void r...
In my WPF application I need to read text from several textboxes. Because the code is running in a different thread to the UI, I need to use Dispatcher.invoke. At the moment I’m working with one textbox which works fine, but now I need all the texts, do I need to write a Dispatcher.invoke for each textbox or is there a way to write a fun...
I have a function that needs to perfom two operations, one which finishes fast and one which takes a long time to run. I want to be able to delegate the long running operation to a thread and I dont care when the thread finishes, but the threads needs to complete. I implemented this as shown below , but, my secondoperation never gets don...
I am trying to build a bluetooth chat application using j2me. I created a thread which is used for connecting to other devices. Two devices can be connected now. I opened the input and output stream. I want to read and write data simultaneously from input and output stream. I dont have any idea how to achieve this?? Should i create a new...
I have a problem with a specific java client library. Here is the situation:
I have made a program that uses the library. The program is a class named 'WorkerThread' that extends Thread. To start it I have made a Main class that only contains a main() function that starts the thread and nothing else. The worker uses the library to perfo...
I searched for examples on how to create a simple multithreaded app that does something similar to this:
#include <iostream>
using namespace std;
int myConcurrentFunction( )
{
while( 1 )
{
cout << "b" << endl;
}
}
int main( )
{
// Start a new thread for myConcurrentFunction
while( 1 )
{
cout << ...