Hopefully this won't post twice...I submitted this same post several
hours ago and google still hasn't updated the form...
We could have problems in the following situations
main thread: creates thread cache thread
cache thread: gets created doesn't run or execute
anything.
main thread: checks to see if thread is running.
it fails because cache thread
never set pr->thread_running to 1.
main thread will spawn another thread.
cache thread 2 : gets created doesn't run or execute
main thread: checks to see if thread is running.
it fails because cache thread
never set pr->thread_running to 1.
main thread will spawn another thread.
...
This could go on. the different cache threads
eventually partially run and mess things up since
they could be working on the same data.
We could in theory create hundreds of threads
if things get scheduled oddly.
So far the simplest way for this to be fixed
is to remove the lines
pr->thread_running = 1;
pr->leave_thread = 0;
from the presenter_cache_thread and
add them presenter_cache right before we
create another thread.
pr->thread_running = 1;
pr->leave_thread = 0;
pr->thread = SDL_CreateThread(presenter_cache_thread, pr);