ILoggable

A place to keep my thoughts on programming

June 12, 2005 .net

Invoke vs. BeginInvoke

Been using the DebugLog code a bunch but kept having the occasional lock-up at shutdown. So i went back to the whole Invoke business. Problem is that while Invoke does make sure our update code runs on the proper thread, it is also synchronous, which means that if you are asking the DebugLog worker to Join and it is just then calling Invoke, you’ve got yourself a deadlock. The thread asking for the Join is now blocked, but it’s also the thread responsible for the handling the Invoke. Solution:Should’ve used BeginInvoke, since it does the call asynchronously, avoiding the the Deadlock issue.

The updated .cs and .resx files are here

As I was typing this, suddenly the room shook as if a truck had hit the house. Turns out there was a 5.6 Earthquake near Anza, CA, about 60 miles away.

Leave a comment