This improves the loading time a lot. Time from starting the app to opening game window decreased by almost 5 seconds (it's almost instant now). Mission loading times are significantly better too. As a bonus, the playmusic() CBot function doesn't hang the game if you don't preload the files with CacheAudio in scene file.
This reverts commit 7cf73c94c4.
I wanted to make this better but failed so badly ;) The memory holding the thread function pointer may be freed before the thread is started, so the whole resource passing thing is needed anyway.
This probably fixes#584
* introduce ResourceOwningThread wrapper for safely passing resources
to new threads
* make CEventQueue thread-safe
* start screenshot saving thread using ResourceOwningThread
* change direct call at end of writing screenshot to thread-safe
event communication