mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
mutex replaced by rwlock
This commit is contained in:
parent
d783a5ba2e
commit
37062d4ab6
1 changed files with 7 additions and 3 deletions
|
@ -43,7 +43,7 @@
|
|||
#include "xwrelay_priv.h"
|
||||
|
||||
/* this is *only* for testing. Don't abuse!!!! */
|
||||
extern pthread_mutex_t gCookieMapMutex;
|
||||
extern pthread_rwlock_t gCookieMapRWLock;
|
||||
|
||||
typedef int (*CmdPtr)( int socket, const char** args );
|
||||
|
||||
|
@ -112,9 +112,9 @@ static int
|
|||
cmd_lock( int socket, const char** args )
|
||||
{
|
||||
if ( 0 == strcmp( "on", args[1] ) ) {
|
||||
pthread_mutex_lock( &gCookieMapMutex );
|
||||
pthread_rwlock_wrlock( &gCookieMapRWLock );
|
||||
} else if ( 0 == strcmp( "off", args[1] ) ) {
|
||||
pthread_mutex_unlock( &gCookieMapMutex );
|
||||
pthread_rwlock_unlock( &gCookieMapRWLock );
|
||||
} else {
|
||||
print_sock( socket, "%s [on|off] (lock/unlock mutex)", args[0] );
|
||||
}
|
||||
|
@ -191,6 +191,7 @@ ctrl_thread_main( void* arg )
|
|||
}
|
||||
}
|
||||
close ( socket );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -206,4 +207,7 @@ run_ctrl_thread( int ctrl_listener )
|
|||
pthread_t thread;
|
||||
int result = pthread_create( &thread, NULL,
|
||||
ctrl_thread_main, (void*)newSock );
|
||||
if ( result ) {
|
||||
logf( "pthread_create(ctrl) => %d", result );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue