multithreading

Unit-testing multithreaded applications

Has anyone got any advice or know of any frameworks for unit-testing of multithreaded applications? ...

How to test thread safety of adding to a hashtable?

We're using a hashtable to store sessions in a web service. I want to test thread safety of adding to this session. I wrote a Console App which generates lots of threads and adds to this session. But I am neither getting an exception nor losing any data. Am I doing anything wrong or isn't this much of operation a threat to hashtable?! ...

How is context switching of threads done on a multi-core processor?

When doing context switching on a single-core processor, the code responsible is executed on the only CPU which takes care of switching the threads. But how is this done when we have multiple CPUs? Is there a master CPU which does all the context switching of all slave CPUs? Is each CPU responsible for its own context switching? If so, ...

Winsock local loop-back latency

I'm using tcp sockets to provide interprocess communication between two apps on Windows XP. I chose tcp sockets for various reasons. I'm seeing an average round-trip time of 2.8 ms. That's much slower than I was expecting. Profiling seems to show that the delay is between one app calling send and the other end's blocking recv returning. ...

Model, View, Controller - I understand the class diagram, but I don't understanding all the threading issues. Advice?

I recently read the Head First Design Patterns book and I especially liked how the chapter on MVC seemed to bring everything together from the previous chapters. However, I am now on the verge of implementing a MVC pattern (using wxWidgets in C++) and I am beginning to realize that I don't understand threading issues as much as I should...

wxWidgets and locking resources.

I'm new to wxWidgets (C++), and threads for that matter. What should I be aware of concerning shared resources? Should I implement some sort of semaphore-based locking of resources that may be used by both the GUI thread and the worker thread(s)? Does wxWidgets offer some capability for dealing with this? ...

Python Threading Concept Question

I'm currently in the process of writing a client server app as an exercise and I've gotten pretty much everything to work so far, but there is a mental hurdle that I haven't been able to successfully google myself over. In the server application am I correct in my thinking that threading the packet handler and database handler to work ...

Python Threads (or their equivalent) on Google Application Engine Workaround?

I want to make a Google App Engine app that does the following: Client makes an asynchronous http request Server starts processing that request Client makes ajax http requests to get progress The problem is that the server processing (step #2) may take more than 30 seconds. I know that you can't have threads on Google Application E...

Creating Thousands of Threads Quickly and Executing Them Near Simultaneously

I have a C#.NET application that needs to inform anywhere from 4000 to 40,000 connected devices to perform a task all at once (or as close to simultaneous as possible). The application works well; however, I am not satisfied with the performance. In a perfect world, as soon as I send the command I would like to see all of the devices r...

What's the best way to get started learning how to write an extremely simple multithreaded c++ program that includes mutex and semaphore use?

What package should I use and what would a "hello world"-level program look like? ...

How do I break a loop that is running in different thread using a TimerCallback in C#?

I am writing a game server that has a time limit. I will be accepting input accross a socket until the timer is done. I am using a forever loop to receive data from the client. while(true) { socket.Receive(buffer); } I need to break out of this loop when the time limit ends. Sorry I don't think I am being specific enough. I h...

How do I compile a simple c++ program that uses std::thread in cygwin?

#include < thread > results in: error: thread: no such file or directory How can I install/use this library? ...

Is Java.sql's getRow() thread safe?

Lets say I have a large number of threads inserting into a mysql database using Java.sql. After i perform an insert i would like to know the primary key of the record i just inserted. I could use getRow() on the ResultSet returned by the insert query. However, is this thread safe? Or should I fire off another select statement to f...

NSPrintOperation hangs application

I have an application that hangs whenever I call NSPrintOperation. I have a view that is creates a separate class (UIView) like this: PBPrintImage *printImage = [[PBPrintImage alloc] init]; printImage.image = finalImage; [printImage printWithNoPanel:self]; Then inside PBPrintImage I have the following method: - (void)printWithNoPane...

How do I compile a simple c++ program that uses boost::thread in cygwin?

I installed boost on cygwin, and tried to compile the following program: #include <iostream> #include <boost/thread/thread.hpp> using namespace std; void hello() { cout << "Hello cworld" << endl; } int main() { boost::thread t(hello); t.join(); } via $ g++ test.cpp -lboost_thread /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../...

Can I pass different types of parameters to an AsyncTask in Android?

I want to implement a generic, thread save class which takes the RessourceId of an ImageView and the Url (http) where the desired image file is stored. It'll download the image and fills the src of the ImageView in the UiThread. I thought AsyncTask would be the best thing for me. However I noticed that I only can pass one type of parame...

Changing the Property of a Brush Colour through a Thread

Hi there, I have a Brush Colour which I would like to change every so and so on a thread. static SolidColorBrush myBrush; Thread changeColourThread = new Thread(changeColour); static void changeColour() { myBrush = new SolidColorBrush(Color.FromArgb(255, 33, 96, 22)); } This returns an UnauthorizedAccessException, what's the...

Cooperative multitasking using TPL

Hi, We are porting modeling application, which uses IronPython scripts for custom actions in modeling process. The existing application executes each Python script in separate thread and uses cooperative model for this. Now we want to port it to TPL, but first we want to measure context switching . Basically, what we have right now: ...

multithreaded logging for high performance application

I have an application (server application) that needs an extensive amount of logging implemented and shouldn't be too affected performance wise by enabling logging. The application has a thread pool of worker threads performing the work. Originally I was going to just log on these thread pool threads, but then I'd need to lock practica...

Do I still have to pass the ActivityContext to the AsyncTask in order to manipulate Views?

This function runs on the UiThread, but it seems that doesnt mean it also has access to the activity context. Shall I implement to my AsyncTask a public Setter to pass the activity (as reference)? protected void onPostExecute( Bitmap bitmap ) { //following is underlined red due to missing context (ImageView)findViewById...