multithreading

How to do multiple Upload/Download in FTP using C#

How to do multiple Upload/Download in FTP using C# without using FtpWebRequest ? I have an idea it can be achieved using threads, but i am not able to begin. If any body has some code snippet for reference for doing multiple Upload/download in FTP using threads, it will be helpful. ...

Could SynchronizationContext be used not in WinForms/WPF application?

I'm writing a component that would be used in WinForms or WPF applications also could be used in Windows services or Unit tests. Is there a way to use SynchronizationContext component in non UI apps? ...

ruby atomic operations in multithreaded environment

Are push and pop operations for arrays atomic? Can i safely run i = array.pop ... array.push(i) in GIL-threaded env? ...

Why can you have millions of actors in an application, but just 10,000 threads is too many?

Why can you have millions of actors in an application, but just 10,000 threads is too many? How is it that creating millions of actors is practical, but more than a couple threads is not? What can threads do that actors can't (or else we would use actors all the time!)? ...

Keeping the same thread name over RMI

Is there any tidy way to keep the same thread name when making an RMI call? At the moment if I have a named thread that makes an RMI call, on the server side of the RMI call, Thread.currentThread().getName() returns something un-illuminating like "RMI TCP Connection(4)-10.0.0.2". Of course, I could go and add to all my RMI methods a par...

ScheduledThreadPoolExecutor Thread Safety.

Hi, Are ThreadPoolExecutor and ScheduledThreadPoolExecutor thread-safe?? Now, I have a scenario as under: 5 ThreadPoolExecutor(s) exec1 (which executes JobA (Job of Level A) : parallelism of 4-5 jobs max), exec2 (which executes JobB (made from List inside each JobA) : over 800-3000 jobs per JobA), exec3 (which executes and prepares J...

volatile and multithreading?

In the following code: #include <pthread.h> #include <unistd.h> #include <stdio.h> pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; int ready = 0; wait() { int i; do { usleep(1000); pthead_mutex_lock(&mutex); i = ready; pthread_mutex_unlock(&mutex); } while (i == 0); printf("Fin...

When to thread?

I have never written any code that uses threads. I have a web application that accepts a POST request, and creates an image based on the data in the body of the request. Would I want to spin off a thread for the image creation, as to prevent the server from hanging until the image is created? Is this an appropriate use, or merely a so...

Using BackgroundWorker in an object and updating UI

Edit: Got somewhere, I hope Here is what I've got, but I'm not so sure about how I delegate my bcLoad.ReportProgress(i) to the object created (ie how to make the delegate so it can be passed). I've created the object events which work sort of(I can call my object method and I can see a change triggered when reading in lines). I know w...

QTimer in a thread - events not processing?

I have an object that is derived from QThread and the class definition includes the Q_OBJECT macro. I created a timer within the thread so I can do some occasional checks while the thread is running; however, the timeout event is never occurring. I've tried making the timer a singleshot as well, but no events are emitted. Are events p...

Best way to ramp down in Jmeter?

We all know Jmeter isn't the best at changing the number of active threads during the run (unless you get fancy and make separate thread groups that fire off at different intervals). Has any come up with a good solution for ramping down at the end of the test? For example, I start with 50 threads and within 30 minutes I want 0 active...

Code Review (first attempt at multithreading)

Ive been working on setting up a throttle to limit the number of messages sent. Although this works, Im curious if there is a better way? Any advice is appreciated. public Class MyApp { private long _messagesSent; private long _totalMessagesSent; public int NumberOfMessages { get; set; } public int MessagesPerSecond { get;...

AsyncTask not displaying onPreExecute

I have two AsyncTask Activities, whose sole responsibilties are to execute an AsyncTask on the UI Thread. One of them works great, displays the progressBar, and updates the ProgressBar message. This is for my SearchActivity, which is actually a search activity with the Google Search metadata for declaring a search activity. I created a c...

Update UITableView using threads

Hi guys, I am creating a dictionary application for iPhone that gives result while the users are typing. I use threads (NSThread) to update the UITableView so that the main thread is not blocked. However, a crash happens when the UITableView asks the data source for the number of rows ( tableView:numberOfRowsInSection:) and I return, s...

Inheriting Task class in C# 4.0

I am trying to schedule a unit of work to process in the background, and produce a result. Originally I was thinking about extending the Task class, and scheduling that instance of the custom task. (thinking of Future and Runnable from Java) Each task encapsulates would multiple properties for input/output. Multiple tasks are processed s...

GDB does not see any threads besides

GDB does not see any threads besides the one in which crash occurred; or SIGTRAP kills my program when I set a breakpoint. ...

How to use wait and notify protocol with multiple threads

Specifically, can somebody tell me what is wrong with this piece of code. It should start the threads, so should print "Entering thread.." 5 times and then wait until notifyAll() is called. But, it randomly prints "Entering.." and "Done.." and still keeps waiting on others. public class ThreadTest implements Runnable { private int n...

Performance difference for multi-thread and multi-process

Few years ago, under Windows environment, I did some testing, by letting multiple instance of CPU computation intensive + Memory access intensive + I/O access intensive application run. I develop 2 versions. One is running under multi-process, another is running under multi-thread. I found the performance is much better for multi-proces...

How to start two threads at "exactly" the same time

The threads should start at same split second. I understand, if you do thread1.start(), it will take some milliseconds before the next execution of thread2.start(). Is it even possible or impossible? ...

Deadlock on tidtcpserver.active = false (Delphi2007/indy10)

I am having a problem with some code that was written by a developer that has now left our company, the code implements a tcpserver that responds to an XML based protocol. This appears to be working absolutely fine in our test environment but one or two customers are having problems with application shutdown. I have traced this to what...