I have an Application, running on Windows 7, compiled with Visual Studio 2013. It uses sockets to interact with another program. That program sends one string to this program, who has a "receiver" thread running that stores the string into a queue. The receiver thread calls EnterCriticalSection, puts the string in the queue, and then calls LeaveCriticalSection. In the main thread of the program, it calls TryEnterCriticalSection before checking this queue and retrieving the string, and then calls LeaveCriticalSection.
This all worked beautifully every time I tried it. Then I added a minimal Direct2D rendering to the program and it stopped working! Literally, all I'm doing extra now is calling:
rt->BeginDraw(); rt->Clear(); rt->EndDraw();
And now it never succeeds on the TryEnterCriticalSection calls! Has anyone seen anything like this before?