mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
initialize mutex before using; fixes a hang since could never aquire
lock. (This bug has always been there, but didn't matter before; maybe pthreads changed.) Comment out self-spawning stuff until can fix df-transfer problems. Other minor changes around logging.
This commit is contained in:
parent
a762f27846
commit
8a94d0d6ef
5 changed files with 9 additions and 4 deletions
|
@ -27,7 +27,7 @@ SRC = xwrelay.cpp \
|
|||
permid.cpp \
|
||||
|
||||
OBJ = $(patsubst %.cpp,%.o,$(SRC))
|
||||
LDFLAGS += -pthread -g
|
||||
LDFLAGS += -pthread -g -lmcheck
|
||||
CPPFLAGS += -g -Wall
|
||||
# turn on semaphore debugging
|
||||
# CPPFLAGS += -DDEBUG_LOCKS
|
||||
|
|
|
@ -398,7 +398,7 @@ CookieRef::handleEvents()
|
|||
XW_RELAY_ACTION takeAction;
|
||||
if ( getFromTable( m_curState, evt.type, &takeAction, &m_nextState ) ) {
|
||||
|
||||
logf( XW_LOGINFO, "%s -> %s on evt %s, act=%s",
|
||||
logf( XW_LOGINFO, "%s: %s -> %s on evt %s, act=%s", __func__,
|
||||
stateString(m_curState), stateString(m_nextState),
|
||||
eventString(evt.type), actString(takeAction) );
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ CRefMgr::CRefMgr()
|
|||
{
|
||||
/* should be using pthread_once() here */
|
||||
pthread_mutex_init( &m_guard, NULL );
|
||||
pthread_mutex_init( &m_SocketStuffMutex, NULL );
|
||||
pthread_rwlock_init( &m_cookieMapRWLock, NULL );
|
||||
}
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ XWThreadPool::real_tpool_main()
|
|||
void
|
||||
XWThreadPool::interrupt_poll()
|
||||
{
|
||||
logf( XW_LOGINFO, "interrupt_poll" );
|
||||
logf( XW_LOGINFO, __func__ );
|
||||
unsigned char byt = 0;
|
||||
int nSent = write( m_pipeWrite, &byt, 1 );
|
||||
if ( nSent != 1 ) {
|
||||
|
|
|
@ -448,10 +448,11 @@ shutdown()
|
|||
static void
|
||||
SIGINT_handler( int sig )
|
||||
{
|
||||
logf( XW_LOGERROR, "sig handler called" );
|
||||
logf( XW_LOGERROR, "%s", __func__ );
|
||||
shutdown();
|
||||
}
|
||||
|
||||
#ifdef SPAWN_SELF
|
||||
static void
|
||||
printWhy( int status )
|
||||
{
|
||||
|
@ -465,6 +466,7 @@ printWhy( int status )
|
|||
logf( XW_LOGINFO, "why: traced" );
|
||||
}
|
||||
} /* printWhy */
|
||||
#endif
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
|
@ -540,6 +542,7 @@ int main( int argc, char** argv )
|
|||
PermID::SetServerName( serverName );
|
||||
PermID::SetIDFileName( idFileName );
|
||||
|
||||
#ifdef SPAWN_SELF
|
||||
/* loop forever, relaunching children as they die. */
|
||||
for ( ; ; ) {
|
||||
pid_t pid = fork();
|
||||
|
@ -555,6 +558,7 @@ int main( int argc, char** argv )
|
|||
logf( XW_LOGERROR, "fork() => %s", strerror(errno) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
g_listener = make_socket( INADDR_ANY, port );
|
||||
if ( g_listener == -1 ) {
|
||||
|
|
Loading…
Reference in a new issue