mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-15 08:47:56 +01:00
mutex tweaks
This commit is contained in:
parent
28edeb1877
commit
e492d8f7b5
3 changed files with 12 additions and 5 deletions
|
@ -417,7 +417,7 @@ comms_make( MPFORMAL XWEnv xwe, XW_UtilCtxt* util, XP_Bool isServer,
|
|||
XP_U16 forceChannel )
|
||||
{
|
||||
CommsCtxt* comms = (CommsCtxt*)XP_CALLOC( mpool, sizeof(*comms) );
|
||||
MUTEX_INIT( &comms->mutex, XP_TRUE );
|
||||
MUTEX_INIT_CHECKED( &comms->mutex, XP_TRUE, 3 );
|
||||
comms->util = util;
|
||||
comms->dutil = util_getDevUtilCtxt( util, xwe );
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -22,7 +22,13 @@
|
|||
#ifdef DEBUG
|
||||
#include <unistd.h>
|
||||
|
||||
#define WAIT_ALL_SECS 3
|
||||
// #define WAIT_ALL_SECS 3
|
||||
/* #define WAIT_ALL_SECS to enable checking for ALL mutexes, but don't do that
|
||||
on Android because it kills the app (because locks in mpool are so
|
||||
frequent, I suspect). I'll keep it on on Linux for testing, but even there
|
||||
it limits how many games I can run at once. I really need a cleverer
|
||||
implementation where a single thread checks everything....
|
||||
*/
|
||||
|
||||
/* What is this? It's my attempt to, on debug builds and for all or only
|
||||
chosen mutexes, get an assertion when the app doesn't get a lock in the
|
||||
|
@ -95,9 +101,9 @@ mtx_lock_prv( MutexState* state, XP_U16 waitSecs,
|
|||
(void)pthread_create( &waitThread, NULL, checkLockProc, &ws );
|
||||
int count = 0;
|
||||
while ( !ws.flagLoc ) {
|
||||
usleep(50); /* wait for thread to start */
|
||||
usleep(500); /* wait for thread to start */
|
||||
if ( 0 == (++count%10) ) {
|
||||
XP_LOGFF( "count %d; flagLoc still null", count );
|
||||
// XP_LOGFF( "count %d; flagLoc still null", count );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
BUILD_DIR ?= .
|
||||
|
||||
ifeq ($(MEMDEBUG),TRUE)
|
||||
DEFINES = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING -DNUMBER_KEY_AS_INDEX
|
||||
DEFINES = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING -DNUMBER_KEY_AS_INDEX
|
||||
DEFINES += -DWAIT_ALL_SECS=3
|
||||
DEFINES += -DLOG_COMMS_MSGNOS
|
||||
DEFINES += -DDI_DEBUG
|
||||
CFLAGS += -g $(GPROFFLAG) -Wall -Wunused-parameter -Wcast-align -Werror -O0
|
||||
|
|
Loading…
Add table
Reference in a new issue