multithreading

Cross Thread Exception in PropertyChangedEvent in WPF

I have a ListView that is binded to my custom collection. At run time , I am updating the certain properties of my entity in my custom collection in my ViewModel. At the same time , I am also doing the custom sorting in the listview. The custom sorting is applicable when I click on the any column header of the listview. For example, ...

How do I start up an NSRunLoop, and ensure that it has an NSAutoreleasePool that gets emptied?

I have a "sync" task that relies on several "sub-tasks", which include asynchronous network operations, but which all require access to a single NSManagedObjectContext. Due to the threading requirements of NSManagedObjectContexts, I need every one of these sub-tasks to execute on the same thread. Due to the amount of processing being don...

Detecting Completion of an Array of Threads

I have created an array of threads and started all of them. How to know whether all threads have completed work. I don't want to use thread.wait or thread.join. ...

Java - when to use notify or notifyAll?

Why does java.lang.Object have two notify methods - notify and notifyAll? It seems that notifyAll does at least everything notify does, so why not just use notifyAll all the time? If notifyAll is used instead of notify, is the program still correct, and vice versa? What influences the choice between these two methods? ...

Simple POSIX threads question

Hi, I have this POSIX thread: void subthread(void) { while(!quit_thread) { // do something ... // don't waste cpu cycles if(!quit_thread) usleep(500); } // free resources ... // tell main thread we're done quit_thread = FALSE; } Now I want to terminate subthread() from my main thread. I've tried th...

Calling QAxWidget method outside of the GUI thread

I'm beginning to wonder if this is impossible, but I thought I'd ask in case there's a clever way to get around the problems I'm having. I have a Qt application that uses an ActiveX control. The control is held by a QAxWidget, and the QAxWidget itself is contained within another QWidget (I needed to add additional signals/slots to the ...

Private Java class properties mysteriously reset between method calls....

I have a very odd problem. A class property is mysteriously reset between method calls. The following code is executed so the constructor is called, then the parseConfiguration method is called. Finally, processData is called. The parseConfiguration method sets the "recursive" property to "true". However, as soon as it enters "proce...

what will be alternative of pthread_setcanceltype in windows thread programming in c++?

what will be alternative of pthread_setcanceltype in windows thread programming in c++? ...

Does WCF use the ThreadPool to bring up new instances for a PerCall service?

Hi, for a PerCall WCF service whose throttling has been set to be high (say, 200 max concurrent calls) would WCF bring up a new instance and invoke the request on a threadpool thread? If it does, then does this have an impact on the total number of concurrent calls allowed? I ask because I don't seem to ever hit the max number of concu...

How to handle recurring execution?

I am trying to validate the solution I came up for what I think is a fairly typical problem. I have a service running and every 10 minutes it should do something. I've ended up with the following: private AutoResetEvent autoResetEvent = new AutoResetEvent(true); private bool isRunning = true; public void Execute() { while(isRunni...

Problem with basic program using Boost Threads in c++

I have a simple program which creates and executes as thread using boost threads in c++. #include<boost/thread/thread.hpp> #include<iostream> void hello() { std::cout<<"Hello, i am a thread"<<std::endl; } int main() { boost::thread th1(&hello); th1.join(); } The compiler throws an error against the th1.join() line....

waiting for 2 different events in a single thread

REMOVED - reason: not really needed. my questions are: can I use a linux UDP socket from two different threads? answer was here I have two different events I would like to wait for using just one thread. One of such events is the addition of an element to a stack and another is the availability of data on a socket. I can use a boost::...

JUnit terminates child threads

Hi to all, When i test the execution of a method that creates a child thread, the JUnit test ends before the child thread and kills it. How do i force JUnit to wait for the child thread to complete its execution? Thanks ...

Callers block until getFoo() has a value ready?

I have a Java Thread which exposes a property which other threads want to access: class MyThread extends Thread { private Foo foo; ... Foo getFoo() { return foo; } ... public void run() { ... foo = makeTheFoo(); ... } } The problem is that it takes some short time from the time this runs until...

Is autoload thread-safe in Ruby 1.9?

It seems to me that the Ruby community has been freaking out a little about autoload since this famous thread, discouraging its use for thread safety reasons. Does anyone know if this is no longer an issue in Ruby 1.9.1 or 1.9.2? I've seen a bit of talk about wrapping requires in mutexes and such, but the 1.9 changelogs (or at least as...

Timer in java ,time difference problem

I want to create a timer for my app. The sample code is shown below. When the method datetwo() is called the same time in milliseconds is shown as there in the main method. Please help me out with this import java.util.Date; import java.util.Timer; public class TimerChe { Timer timer; static Date date = new Date(); static D...

Can someone code review my small SDL app? Want to make sure I didn't make any beginner mistakes

In an effort to teach myself the SDL library (hence my stack overflow handle :) ) I wanted to try my hand at a side-scroller. My code is complete but I want some feedback (mostly because I have an atrocious amount of if and else statements for what seems like some simple logic). My "program" is a c++ side-scroller where you move a singl...

Is a new thread in a Visual Studio test project aborted when the test ends?

Hi, i have to do some message exchange with a 3rd party (in a website). When the client posts a page, i start the message exchange. When that doesn't succeed for some reason, i report this to the client by rendering the page with a message. On the background, in a separate thread, i start a process to send abort messages to the 3rd part...

Non-blocking MySQL updates with java?

For a multiplayer game I'm working on I'd like to record events to the mysql database without blocking the game update thread so that if the database is busy or a table is locked the game doesn't stop running while it waits for a write. What's the best way to accomplish this? I'm using c3p0 to manage the database connection pool. My be...

iPhone equivalent of Application.DoEvents();

iPHone: We use MonoTouch, but Obj-C answers are ok. My singleton domain object takes a while to get all the data so it runs internally parts of the fetch in a thread. I need to inform the UI that the domain is done. Currently I do this. Is there a better way? In WinForms I would call Application.DoEvents() instead of Thread Sleep. ...