multithreading

Is it possible to assign a proxy for each thread in Jakarta Common's HTTPClient?

I want to have multiple threads, each using a different proxy for Jakarta Common's HTTPClient. Last time I check, it was only possible to set one global/static proxy for this API. Does anyone how to accomplish the prior stated goal? ...

Python subprocess get child's output

Possible Duplicates: How to get output from subprocess.Popen() Retrieving the output of subprocess.call() Here is my question. I have an executable called device_console. The device_console provides a command line interface to a device. In device_console, four commands can be run: status, list, clear and exit. Each command p...

Is it possible to build Thread on Global.asax.

I'd like to create Thread for do something in ASP.NET. ...

Is it okay to use "delete this;" on an object that inherits from a Thread class?

In general, if you have a class that inherits from a Thread class, and you want instances of that class to automatically deallocate after they are finished running, is it okay to delete this? Specific Example: In my application I have a Timer class with one static method called schedule. Users call it like so: Timer::schedule((void*)o...

Threadsafe logging inside C++ Shared library

I have implemented multithreaded shared library in C++ (For Linux and Windows). I would like to add logging mechanism inside the library itself. The caller of the library is not aware of that. The log file would be same so i am wondering how could i design the thread safe logging if multiple process is using my library and trying to open...

wpf method to start the application message loop

Hi All, I need to create a Form in a different thread and keep it ranning until a user performe some action in the main thread (click a button). It is not very difficult to do using System.Windows.Forms.Application.Run(new ApplicationContext()); that starts an application message loop in the current thread. But this solution requir...

AutoResetEvent object , waits 60 secs OR event

Im using AutoResetEvent object to block a thread for 60 secs ,, but I would like to block it for 60 secs or AutoResetEvent.set() event CODE : global: private readonly AutoResetEvent _signal = new AutoResetEvent(false); blocking: _signal.WaitOne(60000, true); event to give signal _signal.Set(); but it alwayas waits the whole 60 se...

Need a Syncroot for a LinkedList(of T)

Hi I am using VB.Net and would like to use a LinkedList. Only problem is that it is a multithreaded application. I saw from MSDN that Syncroot is an explicit implementation of the ICollection Interface. I found people wanting to do similar things with List(Of T). It seems that the solution there is to cast the list to the interface. I ...

Use Threads in Midlet: how to listen to running thread?

in my class I have an inline thread in the constructor that loads objects from a remote site: Thread readSite = new Thread(new Runnable() { public void run() { site.loadStuff(); } }); readSite.start(); I want to display a 'loading' message until the thread is finished. So before the above code I show a loadin...

UIAlertView / Threading issue

In my App, when a certain button is pressed, I call a method (postButtonClicked:) that parses a web service on a separate thread. I then display the user an UIAlertView to inform them whether the call was successful or not. Here is the code I use: - (void)postButtonClicked:(id)sender { [NSThread detachNewThreadSelector:@selector(p...

MySql: How do you use mutex/lock in a stored-procedure

I want my function to only run once. Meaning that if many threads call it at the same time, the function will block all threads apart from one and only allow it to run. ...

Is there an alternative to the threading.Condition variables in python that better support timeouts without polling?

I'm using condition variables in threads that require a timeout. I didn't notice until I saw the CPU usage when having a lot of threads running, that the condition variable provided in the threading module doesn't actually sleep, but polls when a timeout is provided as an argument. Is there an alternative to this that actually sleeps li...

ASP.NET multithreading & "thread has already entered the lock"

In an ASP.NET application, I have a resource that is protected by a ReaderWriterLockSlim. Normal requests call EnterReadLock, access the resource, call ExitReadLock and return. At one moment, I accidently forgot to put a call to ExitReadLock somewhere in my code. On the next request, I got an exception stating that the thread had alrea...

"Wait Please" form hides main form

I have some long processes in my app, so I've created a WAIT PLEASE form and I call on another thread like this: public void ShowWait() { continueWait = true; ThreadPool.QueueUserWorkItem((x) => { using (frmWait espera = new frmWait()) { espera.ShowInTas...

Usage of nested using in C# and SQL Server

This thread is a continuation of http://stackoverflow.com/questions/2220422/is-there-a-reason-to-check-for-null-inside-multiple-using-clausule-in-c I've noticed that resharper lets me define using without opening any opening/closing bracket like in the method below (but then i can't use defined vars later on if the brackets ain't there,...

Delegate, BeginInvoke. EndInvoke - How to clean up multiple Async threat calls to the same delegate?

I've created a Delegate that I intend to call Async. Module Level Delegate Sub GetPartListDataFromServer(ByVal dvOriginal As DataView, ByVal ProgramID As Integer) Dim dlgGetPartList As GetPartListDataFromServer The following code I use in a method Dim dlgGetPartList As New GetPartListDataFromServer(AddressOf AsyncThreadMethod_G...

Using Interlocked

Is this code thread-safe? or put it this way: Is there anyway to call GetIt() and that GetIt() will return the same number to 2 different threads Private Shared hitCount As Long = 1 Public Shared Function GetIt() As Long Threading.Interlocked.Increment(hitCount) DoSomethingQuick(hitCount) Return hitCount End Function ...

Passing param to delegate method running on new thread .. Am I crossing UI/Thread bounds?

I have a delegate for a method. I start it in a new thread that has a parameter in it in which I pass a DataView into. The new thread is obviously not running on the UI thread so I should not be accessing any UI controls. The dataview I am passing into the delegated method however I got the reference from ComboBox.DataSource where Com...

Changing thread priority to make my program and computer more responsive

I've written a .NET winforms application that uses a secondary thread to do some heavy processing, which communicates it's progress back to the UI thread. Everything works correctly, the form shows the progress, and I've also created a cancel button to interrupt the processing thread. However, when the time consuming process is going the...

Threading 101: What is a Dispatcher?

Once upon a time, I remembered this stuff by heart. Over time, my understanding has diluted and I mean to refresh it. As I recall, any so called single threaded application has two threads: a) the primary thread that has a pointer to the main or DllMain entry points; and b) For applications that have some UI, a UI thread, a.k.a the se...