I came across something I simply don\'t understand. In my application I have several threads all adding (and removing) items to a shared collection (using a shared lock). Th
Good question!
All waits in .NET are "alertable." This means that if a wait blocks, Windows can run "Asynchronous Procedure Calls" on top of the waiting stack. This can include processing some windows messages. I haven't tried WM_PAINT specifically, but from your observations, I guess it is included.
Some MSDN links:
Wait Functions
Asynchronous Procedure Calls
Joe Duffy's book "Concurrent Programming on Windows" also covers this.