19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL - Simple DirectMedia Layer 39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Copyright (C) 1997-2012 Sam Lantinga 49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is free software; you can redistribute it and/or 69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall modify it under the terms of the GNU Lesser General Public 79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License as published by the Free Software Foundation; either 89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall version 2.1 of the License, or (at your option) any later version. 99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is distributed in the hope that it will be useful, 119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall but WITHOUT ANY WARRANTY; without even the implied warranty of 129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Lesser General Public License for more details. 149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall You should have received a copy of the GNU Lesser General Public 169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License along with this library; if not, write to the Free Software 179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Sam Lantinga 209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall slouken@libsdl.org 219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/ 229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_config.h" 239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* An implementation of condition variables using semaphores and mutexes */ 259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This implementation borrows heavily from the BeOS condition variable 279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall implementation, written by Christopher Tate and Owen Smith. Thanks! 289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_thread.h" 319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstruct SDL_cond 339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_mutex *lock; 359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int waiting; 369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int signals; 379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_sem *wait_sem; 389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_sem *wait_done; 399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Create a condition variable */ 429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallDECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void) 439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_cond *cond; 459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond)); 479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( cond ) { 489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall cond->lock = SDL_CreateMutex(); 499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall cond->wait_sem = SDL_CreateSemaphore(0); 509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall cond->wait_done = SDL_CreateSemaphore(0); 519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall cond->waiting = cond->signals = 0; 529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( ! cond->lock || ! cond->wait_sem || ! cond->wait_done ) { 539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_DestroyCond(cond); 549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall cond = NULL; 559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_OutOfMemory(); 589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return(cond); 609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Destroy a condition variable */ 639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallDECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond) 649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( cond ) { 669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( cond->wait_sem ) { 679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_DestroySemaphore(cond->wait_sem); 689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( cond->wait_done ) { 709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_DestroySemaphore(cond->wait_done); 719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( cond->lock ) { 739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_DestroyMutex(cond->lock); 749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_free(cond); 769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Restart one of the threads that are waiting on the condition variable */ 809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallDECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond) 819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( ! cond ) { 839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_SetError("Passed a NULL condition variable"); 849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return -1; 859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* If there are waiting threads not already signalled, then 889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall signal the condition and wait for the thread to respond. 899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_LockMutex(cond->lock); 919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( cond->waiting > cond->signals ) { 929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++cond->signals; 939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_SemPost(cond->wait_sem); 949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_UnlockMutex(cond->lock); 959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_SemWait(cond->wait_done); 969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_UnlockMutex(cond->lock); 989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return 0; 1019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 1029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Restart all threads that are waiting on the condition variable */ 1049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallDECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond) 1059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 1069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( ! cond ) { 1079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_SetError("Passed a NULL condition variable"); 1089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return -1; 1099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* If there are waiting threads not already signalled, then 1129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall signal the condition and wait for the thread to respond. 1139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 1149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_LockMutex(cond->lock); 1159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( cond->waiting > cond->signals ) { 1169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int i, num_waiting; 1179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall num_waiting = (cond->waiting - cond->signals); 1199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall cond->signals = cond->waiting; 1209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( i=0; i<num_waiting; ++i ) { 1219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_SemPost(cond->wait_sem); 1229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Now all released threads are blocked here, waiting for us. 1249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Collect them all (and win fabulous prizes!) :-) 1259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 1269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_UnlockMutex(cond->lock); 1279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for ( i=0; i<num_waiting; ++i ) { 1289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_SemWait(cond->wait_done); 1299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 1319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_UnlockMutex(cond->lock); 1329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return 0; 1359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 1369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Wait on the condition variable for at most 'ms' milliseconds. 1389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall The mutex must be locked before entering this function! 1399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall The mutex is unlocked during the wait, and locked again after the wait. 1409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallTypical use: 1429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallThread A: 1449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_LockMutex(lock); 1459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall while ( ! condition ) { 1469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_CondWait(cond); 1479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_UnlockMutex(lock); 1499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallThread B: 1519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_LockMutex(lock); 1529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ... 1539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall condition = true; 1549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ... 1559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_UnlockMutex(lock); 1569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 1579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallDECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms) 1589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 1599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int retval; 1609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( ! cond ) { 1629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_SetError("Passed a NULL condition variable"); 1639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return -1; 1649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Obtain the protection mutex, and increment the number of waiters. 1679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This allows the signal mechanism to only perform a signal if there 1689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall are waiting threads. 1699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 1709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_LockMutex(cond->lock); 1719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ++cond->waiting; 1729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_UnlockMutex(cond->lock); 1739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Unlock the mutex, as is required by condition variable semantics */ 1759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_UnlockMutex(mutex); 1769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Wait for a signal */ 1789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( ms == SDL_MUTEX_MAXWAIT ) { 1799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall retval = SDL_SemWait(cond->wait_sem); 1809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 1819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall retval = SDL_SemWaitTimeout(cond->wait_sem, ms); 1829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Let the signaler know we have completed the wait, otherwise 1859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall the signaler can race ahead and get the condition semaphore 1869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if we are stopped between the mutex unlock and semaphore wait, 1879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall giving a deadlock. See the following URL for details: 1889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall http://www-classic.be.com/aboutbe/benewsletter/volume_III/Issue40.html 1899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 1909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_LockMutex(cond->lock); 1919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( cond->signals > 0 ) { 1929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* If we timed out, we need to eat a condition signal */ 1939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if ( retval > 0 ) { 1949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_SemWait(cond->wait_sem); 1959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* We always notify the signal thread that we are done */ 1979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_SemPost(cond->wait_done); 1989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Signal handshake complete */ 2009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall --cond->signals; 2019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 2029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall --cond->waiting; 2039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_UnlockMutex(cond->lock); 2049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Lock the mutex, as is required by condition variable semantics */ 2069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_LockMutex(mutex); 2079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return retval; 2099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 2109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Wait on the condition variable forever */ 2129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallDECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex) 2139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 2149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return SDL_CondWaitTimeout(cond, mutex, SDL_MUTEX_MAXWAIT); 2159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 216