multithreading

Windows Service And Thread Programming .NET

I have developed windows service to process files whose records will be stored in database. When windows service finds a file it creates a thread and assigns each file to one thread. I have not used Thread Pool. I wanted to know when windows service is stopped, then how to identify how many threads are running and whether they are comple...

What Use are Threads Outside of Parallel Problems on MultiCore Systesm?

Threads make the design, implementation and debugging of a program significantly more difficult. Yet many people seem to think that every task in a program that can be threaded should be threaded, even on a single core system. I can understand threading something like an MPEG2 decoder that's going to run on a multicore cpu ( which I've...

Using a non-thread-safe component with a multithread component (Design)

Design problem : Using a non-thread-safe component (Collection, API, ...) in/with a multithread component ... Example : component1 : A multithread socket server who send messages ... to a message handler component2 : A non-thread-safe message handler who process messages ... from a server My solution : Adding a thread-safe componen...

Help threading HttpWebRquest in c#

Hi guys just wondering if somebody could help me try and correctly thread my application, I am constantly hitting an hurdle after another, I have never been to clued up on threading in applications. I have tryed following this http://www.developerfusion.com/code/4654/asynchronous-httpwebrequest/ tutorial. basically I'm just trying to st...

How can I run 2 servers at once in Python?

Hello, I need to run 2 servers at once in Python using the threading module, but to call the function run(), the first server is running, but the second server does not run until the end of the first server. This is the source code: import os import sys import threading n_server = 0 n_server_lock = threading.Lock() class ServersThread...

Using Custom Events in QT4

I have an app that has a progress bar & spawns a worker thread to do some work & report back progress. The dialog class overrides the customEvent method so that I can process events that are being passed to the gui thread via the worker thread. Before I was using a QThread derived class as the worker thread and I changed it to use ACE_...

Synchronous NSURLConnection Threading on iPhone

I started out using asynchronism but to get the returned data became a hassle. I then began using class methods which, I believe, ruled out the possibility of using the delegate methods. So I kept with the synchronous, knowing that this would be an issue but didn't think I would have this much difficulty with a solution. What is the best...

How to use SafeWaitHandle.DangerousGetHandle?

I have an unmanaged code that calls an asynchronous managed method that returns a handle, and then the unmanaged code use that handle to wait, reading a little documentation I found out that SafeWaitHandle provide 2 other methods (DangerousAddRef and DangerousRelease ). Should I use these methods in order to prevent the Handle from not b...

Thread safety in JSF

Assume that we have Spring bean UserController with singleton scope. All my further reasoning is based on my assumption that "singleton" scope is almost similar to application scope i.e. we have only one instance for all users. If this is wrong assumption then tell me about it, please. So, we have a web-form with several fields. Two ...

MFC basic structure questions

There are few things I'm not sure of : When you create a basic SDI using MFC app wizard (let's call it TestMfc) you get : 4 major classes : CTestMfcApp CTestMfcView CTestMfcDoc CMainFrame What I noticed is that CTestMfcApp has those declaration ON_COMMAND(ID_APP_ABOUT, &CTestMfcApp::OnAppAbout) // Standard file based document c...

How do I create multiple threads in same class?

Hi, all! I want to create multiple threads in my application. I' using following code for creating a thread. This' buttonPress method where I'm creating a thread: (void) threadButtonPressed:(UIButton *)sender { threadStartButton.hidden = YES; threadValueLabel.text = @"0"; threadProgressView.progress = 0.0; [NSThread detachNewThrea...

Multiple Thread Variable Access inside a function

I have a function that launches a couple of threads (it's a test function) and one of the threads mutates the state of a variable. Since local variables cannot be marked volatile, I would assume that multiple threads in that method will always have the updated state of the variable. Is this correct? Here is the sample code public void s...

Limiting concurrent threads equal to number of processors?

Are there any benefits to limiting the number of concurrent threads doing a given task to equal the number of processors on the host system? Or better to simply trust libraries such as .NET's ThreadPool to do the right thing ... even if there are 25 different concurrent threads happening at any one given moment? ...

increment the priority of a thread in Linux

I am reading data from a HID device using hiddev , there is a dedicated thread to read off of it, but it seems that thread is dropping some packets. I can see the packets in the kernel buffers(usbmon) but some of them don't reach user space. The reads inside the reading thread mostly finish on time(~4ms). I think the process is not getti...

how to use omp barrier on a while loop with no equal number of iterations for threads

Hi! I'm trying to implement the listranking problem (known also by shortcutting) with omp to have the sums prefixes of the array W. I don't know if i use correctly the flush pragma.. And i have a warning when compiling "barrier region may not be closely nested inside of work-sharing, critical, ordered, master or explicit task region" #i...

Will linqtosql take care if many threads are accessing the same table of the database at the same time?

I am working on a asp.net mvc application. I have a situation where I have to make many threads which are going to access the database using linqtosql. My question is, will it be fine to leave every thing on linqtosql to maintain the synchronization, because the threads will be accessing the database at the same time. Or I have to write ...

How do I add thread to my server?

I'm a beginner in Java and I have an assignment to build P2p File Sharing Java application. I started by creating server and client. Client can send messages to server and server responds. I believe the next step should be inserting the Thread into the server class. I read all about it and tried it bud I just can't pull it off. I hope so...

Threading on bootloader

Where can I find resources/tutorials on how to implement threads on a x86 architecture bootloader... lets say I want to load resources in the background while displaying a progress bar.. ...

Benefits of Thread Joining

What are the benefits of thread joining ? If the point is to join a thread to stop a thread A until thread B is finished executing, for instance (B.join()) why not use a global variable to do this? ...

The difference between Executors.newSingleThreadExecutor().execute(command) and new Thread(command).start();

Well title says it, what is the difference between Executors.newSingleThreadExecutor().execute(command) and new Thread(command).start(); ...