Skip to content

Instantly share code, notes, and snippets.

@Ratstail91
Created June 10, 2013 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ratstail91/5748293 to your computer and use it in GitHub Desktop.
Save Ratstail91/5748293 to your computer and use it in GitHub Desktop.
Basic mutex template, using SDL's threading systems.
int thread(void*) {
SDL_mutexP(lock); //remember: p for pause
if (/* not ready */) {
SDL_CondWait(cond, lock);
}
//do something
SDL_mutexV(lock);
SDL_CondSignal(otherCond);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment