Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: problem with backgroundworker

0
0
Hi notahack,

and just hanged. Is that possible?

Yes, absolutely. For synchronous invocation, the calling thread must wait until the target thread is done executing the call. In your case, the target thread is waiting for an event signal, so it is unavailable to execute the call, and you get deadlock.

We can't help much without knowing your application's architecture. APIs provide various tools for achieving correctness and robustness in multithreaded programs; the dispatcher is just one such tool. The key to using it is that the target thread (the one that owns the dispatcher) must be coded a certain way; specifically, it must process the dispatch queue. Windows GUI threads typically do this, but custom threads can use methods such as Dispatcher.PushFrame().

Check out the MSDN documentation in this area, but remember that the dispatcher is just one tool. The engine's only requirement is that you always access it on the thread that created it, and there are many ways to accomplish that.

I assume this scenario also applies to the microsoft javascript. Does it apply to the V8 engine also?

V8ScriptEngine instances don't have thread affinity, but they don't support concurrent access either. Each instance is protected by a lock, but there are still plenty of ways to get into trouble :)

Good luck!

Viewing all articles
Browse latest Browse all 2297