multithreading

Will this make the object thread-safe?

I have a native Visual C++ COM object and I need to make it completely thread-safe to be able to legally mark it as "free-threaded" in th system registry. Specifically I need to make sure that no more than one thread ever accesses any member variable of the object simultaneously. The catch is I'm almost sure that no sane consumer of my ...

On MacOSX, in a C++ program, what guarantees can I have on file IO

I am on MacOSX. I am writing a multi threaded program. One thread does logging. The non-logging threads may crash at any time. What conventions should I adopt in the logger / what guarantees can I have? I would prefer a solution where even if I crash during part of a write, previous writes still go to disk, and when reading back the lo...

How to have synchronous writing to a file (Threads) ?

Hi all. I created and started some Threads that each one writes something to a common text file. but the following error appears to me: "The process cannot access the file 'C:\hello.txt' because it is being used by another process." void AccessFile() { int num = 5; Thread[] trds = new Thread[5]; for (int ...

run threads on server side & show progress on client side possible???

I want to run a thread pool on server side & want to show threads work progress on client side. Is this possible. If so kindly guide me. thanx in advance ...

How to prevent GUI blocking?

Hi, I have a timer that ticks every 3 seconds. If the timer found something a messagebox will show. Then the timer should wait 30 seconds, before he show again the messagebox (the user of course must have time to react). How can I handle this? I tried a Thread.Sleep(30000), but the GUI blocks of course. My other Idea is a second time...

Locking directory and make other part of the code to wait until the directory is released by the thread.

How to lock the directory that is beign processed in a thread ? and The Wait to write a new set of file to the directory after the folder is released by the thread that started procesing the folder? ...

python blocking sockets, send returns immediately

Hi, I am writing a multithreaded socket application in Python using the socket module. the server listens for connections and when it gets one it spawns a thread for that socket. the server thread sends some data to the client. but the client is not yet ready to receive it. I thought this would have caused the server to wait until the ...

Multi-Threading - Cleanup strategy at program end

What is the best way to finish a multi-threaded application in a clean way? I am starting several socket connections from the main thread in seperate sockets and wait until the end of my business day in the main thread and use currently System.Environment.Exit(0) to terminate it. This leads to an unhandled execption in one of the childs....

Winforms application hangs when switching to another app

Hi, I believe I have a potential threading issue. I have a user control that contains the following code: private void btnVerify_Click(object sender, EventArgs e) { if (!backgroundWorkerVerify.IsBusy) { backgroundWorkerVerify.RunWorkerAsync(); } } private void backgroundWorkerVerify_DoW...

C++ Thread level constants

Is there a way by which we can simulate thread level constants in C++? For example, if i have to make a call to template functions, then i need to mention the constants as template level parameters? I can use static const variables for template metaprogramming, but they are process level constants. I know, i am asking a question with a...

Quee operations on Apache with PHP (Run in the background)

Hi. I want to be able to in some way "quee" operations on Apache web server with PHP. For example I want to create a loop like this: <?php foreach($files as $key=>$value){ download($value); } ?> The "download" function just runs wget and downloads the file to a specified position. This is working OK but my problem is that during this...

How do I pause main() until all other threads have died?

In my program, I am creating several threads in the main() method. The last line in the main method is a call to System.out.println(), which I don't want to call until all the threads have died. I have tried calling Thread.join() on each thread however that blocks each thread so that they execute sequentially instead of in parallel. Is ...

How to detect whether an EventWaitHandle is waiting?

I have a fairly well multi-threaded winforms app that employs the EventWaitHandle in a number of places to synchronize access. So I have code similar to this: List<int> _revTypes; EventWaitHandle _ewh = new EventWaitHandle(false, EventResetMode.ManualReset); void StartBackgroundTask() { _ewh.Reset(); Thread t = new Thread(new ...

Will thread.join() block other clients also?

In an asp.net web application, say everytime the user makes the request, and the page loads, a thread is fired off that uses thread.join() to block execution until it's finished. Say this thread takes 10 seconds to complete. Does this mean that if 5 totally seperate users make a request to this page, mere miliseconds after the last, do...

Run java thread at specific times

I have a web application that synchronizes with a central database four times per hour. The process usually takes 2 minutes. I would like to run this process as a thread at X:55, X:10, X:25, and X:40 so that the users knows that at X:00, X:15, X:30, and X:45 they have a clean copy of the database. It is just about managing expectation...

what are the difficulties of operating system multithreading?

I am reading a book that compares two ways of implementing threads, Middleware Threads and OS Threads. I don't know what the meaning of these sentences are exactly: "A difficulty of operating system multithreading, however, is performance overhead. Since it is the operating system that is involved in switching threads, this involves syst...

Testing approach for multi-threaded software

I have a piece of mature geospatial software that has recently had areas rewritten to take better advantage of the multiple processors available in modern PCs. Specifically, display, GUI, spatial searching, and main processing have all been hived off to seperate threads. The software has a pretty sizeable GUI automation suite for funct...

Java multi-threading - what is the best way to monitor the activity of a number of threads?

I have a number of threads that are performing a long runing task. These threads themselves have child threads that do further subdivisions of work. What is the best way for me to track the following: How many total threads my process has created What the state of each thread currently is What part of my process each thread has current...

Handling user interface in a multi-threaded application (or being forced to have a UI-only main thread)

In my application, I have a 'logging' window, which shows all the logging, warnings, errors of the application. Last year my application was still single-threaded so this worked [quite] good. Now I am introducing multithreading. I quickly noticed that it's not a good idea to update the logging window from different threads. Reading so...

problem with two .NET threads and hardware access

I'm creating an application which communicates with the device via FT2232H USB/RS232 converter. For communication I'm using FTD2XX_NET.dll library from FTDI website. I'm using two threads: first thread continuously reads data from the device the second thread is the main thread of the Windows Form Application I've got a problem when ...