multithreading

app pool settings kill threads but keep settings

.net 2.0 aspx app / IIS6 creating a silly number of threads in w3wp.exe process app pool. The app has been isolated to its own app pool with the following settings: RECYCLING recycle worker processses (in minutes) : 870 recycle worker process (no of requests): (not ticked) recycle worker processes at the following times: 00:00 max vi...

Threading and Sockets

I have the following: ThreadStart startThread = delegate { mySocket.StartListen(); }; mySocket is now looping on a Listen() when I: new Thread(startThread).Start(); Here is StartListen: public void StartListen() { Object locker = new Object(); // Lock resources lock (locker) { S = new System.N...

Multithreading with ASP.NET and IIS

Hello, We have a web application that needs to process a large amount of data and push messages to a series of MSMQueues. This operation is likely to take upwards of 10 minutes but we want a response back (consisting of an ID) quickly. Therefore, we have implemented a system that generates the ID and starts the push process on a separ...

Question about mutexes and locks

Are the two code samples below equivalent? Poco::ProcessHandle::PID ProcessRunner::processId() const { Poco::ProcessHandle::PID pid = 0; mMutex.lock(); pid = mPID; mMutex.unlock(); return pid; } , Poco::ProcessHandle::PID ProcessRunner::processId() const { Poco::ScopedLock<Poco::Mutex> lock(mMutex); return...

Adding menu items from a separate thread.

I'm creating menu items in a separate thread and adding them to the menu created in the main thread. I'm using Invoke for that. Getting "Value does not fall within the expected range" exception. //creating new thread Thread thread = new Thread(LoadRecentTasks); thread.IsBackground = true; ...

What is the most efficient implementation of a java like object monitor in C++?

In Java each object has a synchronisation monitor. So i guess the implementation is pretty condensed in term of memory usage and hopefully fast as well. When porting this to C++ what whould be the best implementation for it. I think that there must be something better then "pthread_mutex_init" or is the object overhead in java really so...

Using ThreadPool threads with long running ADO.NET queries. Is this scalable?

We are currently enhancing an ASP.NET app that performs quotes on a number of products. At present the existing quote engine is basically a big stored procedure (2-3 secs per call) followed by a small amount of business logic that runs after the procedure call. We are looking into multi-threading the call to each product in order to sp...

Qt4.5: Using event-loop based localsocket before app.exec

I'm facing a practical problem with Qt. I'm using a class that communicates with QLocalSocket to another process (pipes/unix sockets) and I need to do that communication before other events occur, that is before app.exec() starts (or more precisely,as soon as app starts). The class that I'm using needs an eventloop so it does not work i...

Logging safely from a worker thread?

In one of my worker threads I want to do some logging. The log messages are channeled to a GUI textarea, which should only be accessed from the main thread. So the problem is: how do I log messages safely from a worker thread? My current solution is to have the logging function check whether we are currently in the main thread. If yes, ...

Threading and un-safe variables

I have code listed here: Threading and Sockets. The answer to that question was to modify isListening with volatile. As I remarked, that modifier allowed me to access the variable from another thread. After reading MSDN, I realized that I was reading isListening from the following newly created thread process. So, my questions now: ...

Wait thread question

I have a UserControl with a tree on it. It uses multithreading to add nodes to it. I have a function called Expand which I need to execute after filtering completed and since I'm a newbie with multithreading I'm not sure how to do that. Here's my code: class MyClass : UserControl { private Thread nThread; private bool searchLoad...

Ruby/RoR and many subprocesses

I am trying to build a free web application using ruby/rails It should be able to send sms through online forms of various mobile operators. (like this one (in russian)). So, I need to wait for the user, who wants to send an sms through my website. establish connection to operator website. Probably, using Mechanize. retrieve captcha s...

Is this threading code doing what I think it is?

I have written the following code to perform some simultaneous HTTP posting and file archiving: Dim t1 As New Threading.Thread(New Threading.ThreadStart(AddressOf ProcessNTSMessageQueue)) Dim t2 As New Threading.Thread(New Threading.ThreadStart(AddressOf ProcessNTSMessageQueue)) Dim t3 As New Threading.Thread(New Threading.ThreadStart(A...

Threadpool is getting used by windows service problem

Hi Guys, I have created a windows service which is currently having three timers. First timer is waking up every 15 sec, second timer is waking every min. and the third timer is waking everyday. THe problem is these are spawning new threads every time and one time the threadpool gets used up completely.Is ther any to just spawn 3 thread...

Can I (safely) use the ThreadStatic attribute in ADO.NET Data Services?

I want to store per-thread data in an ADO.NET Data Service. Is it safe to use the ThreadStatic attribute on my thread-specific static variable, or will I run into problems? My concern is that my ThreadStatic variable(s) won't be garbage collected after the request is completed and the thread dies. If there's a better way to do what I'm...

ensure runnig finally in spawned Thread, when spawner hits a RuntimeException?

Hi, Ran into a problem. I have a spawned thread that must call its finally block. Assuming code below, is it possible to ensure that finally in the runnable is called? import org.junit.Test; public class ThreadTest { @Test public void testThreadFinally() throws InterruptedException { Runnable r = new Runnable() { ...

Interlocked and Memory Barriers

I have a question about the following code sample (*m_value* isn't volatile, and every thread runs on a separate processor) void Foo() // executed by thread #1, BEFORE Bar() is executed { Interlocked.Exchange(ref m_value, 1); } bool Bar() // executed by thread #2, AFTER Foo() is executed { return m_value == 1; } Does using Inte...

java.util.concurrent vs. Boost Threads library

Hi, How does the Boost Thread libraries compare against the java.util.concurrent libraries? Performance is critical and so I would prefer to stay with C++ (although Java is a lot faster these days). Given that I have to code in C++, what libraries exist to make threading easy and less error prone. I have heard recently that as of JDK...

Unnecessary Java context switches

I have a network of Java Threads (Flow-Based Programming) communicating via fixed-capacity channels - running under WindowsXP. What we expected, based on our experience with "green" threads (non-preemptive), would be that threads would switch context less often (thus reducing CPU time) if the channels were made bigger. However, we foun...

Pthreads question

How to check if a thread is terminated? In my case, I have my_pthread[5] and I want to check if any in 5 threads has finished its job (terminated???I'm not sure) then I can give them another work to do. If I use pthread_join(), then it has to be pthread_join(my_pthread[0]); ... pthread_join(my_pthread[4]); What if thread[3] finishes...