pthread_exit 에서 wait 상태에서 풀리지 않습니다.
전문을 받아 쓰레드로 처리하는 프로그램입니다.
pthread_exit 에서 wait 상태에서 풀리지 않습니다.
OS는 AIX5.3입니다.
아래는 dbx를 떠본 결과입니다.
여기 저기 찾아봤지만, 딱 들어맞는 결과를 찾기는 힘드네요.
전문가님들의 조언 구합니다.
# dbx -a 1753222
(dbx) thread
$t1 wait 0xf10006000126ea08 running 10657877 k no pro main
$t211857 runnable u no pro _usched_swtch
$t210510 wait 0x09001000a02a86b0 running 9392205 k no pro _event_notify
$t210752 wait 0x09001000a02a9460 running 3207371 k no pro _event_notify
$t210753 wait 0x00000001100126d8 blocked 9117809 k no pro _usched_dispatch_front
$t211271 wait 0x09001000a02a9840 running 3481713 k no pro _event_notify
$t211936 wait 0x09001000a02a6e40 running 6775035 k no pro pthread_exit
$t210754 wait 0x09001000a02a8580 running 10604603 k no pro _event_notify
$t211119 wait 0x09001000a02a7f70 running 5161195 k no pro _event_notify
$t211683 wait 0x00000001100126d8 blocked 6025361 k no pro _usched_dispatch_front
$t211012 wait 0x09001000a02a6e40 running 8294603 k no pro pthread_exit
$t211013 wait 0x00000001100126d8 blocked 7503965 k no pro _usched_dispatch_front
$t211618 wait 0x09001000a02a81b0 running 4501583 k
(dbx) thread
$t1 wait 0xf10006000126ea08 running 10657877 k no pro main
$t211857 runnable u no pro _usched_swtch
$t210510 wait 0x09001000a02a86b0 running 9392205 k no pro _event_notify
$t210752 wait 0x09001000a02a9460 running 3207371 k no pro _event_notify
$t210753 wait 0x00000001100126d8 blocked 9117809 k no pro _usched_dispatch_front
$t211271 wait 0x09001000a02a9840 running 3481713 k no pro _event_notify
$t211936 wait 0x09001000a02a6e40 running 6775035 k no pro pthread_exit
$t210754 wait 0x09001000a02a8580 running 10604603 k no pro _event_notify
$t211119 wait 0x09001000a02a7f70 running 5161195 k no pro _event_notify
$t211683 wait 0x00000001100126d8 blocked 6025361 k no pro _usched_dispatch_front
$t211012 wait 0x09001000a02a6e40 running 8294603 k no pro pthread_exit
$t211013 wait 0x00000001100126d8 blocked 7503965 k no pro _usched_dispatch_front
$t211618 wait 0x09001000a02a81b0 running 4501583 k no pro _event_notify
$t211464 wait 0x09001000a02a6e40 running 5972151 k no pro pthread_exit
$t211832 wait 0x09001000a02a6e40 running 7737449 k no pro pthread_exit
:
int iSockFd;
void *Server( void *arg );
/*
* Function Name : main
* Argument : int argc, char *argv[]
* Return Value : int
* Description : Main Function
*/
int main( int argc, char *argv[] )
{
:
:
while( 1 )
{
:
:
iAcptFd = accept( iSockFd, &peeraddr_in, &iAdrLen );
:
:
if( pthread_create( &stTrdBuf.ptThread[iIndexN], NULL, Server, (void *)stAllocBuf ) )
{
LOGPUT( _FL_, 9, 0, "Thread Create Error=[%d]", errno );
LibFreeThreadContext( iIndexN );
free( stAllocBuf );
close( iAcptFd );
}
} /* end of while() */
} /* end of main() */
/*
* Function Name : Server
* Argument : void *arg( Socket Fd )
* Return Value : void *
* Description : Thread Create Server Function
*/
void *Server( void *arg )
{
:
:
pthread_detach( pthread_self() ); /* Thread 분리 */
:
:
close( iAcptFd ); if( sAllocBuf ) free( sAllocBuf );
if( LibFreeThreadContext( iIndexN ) ) /* iIndex 번째 Thread Free */
{
LOGPUT( _FL_, 9, 0, "LibFreeThreadContext Error=[%d]", errno );
}
pthread_exit( (void *)NULL );
} /* end of Server() */ 

pthread_exit( (void *)NULL
pthread_exit( (void *)NULL )를 빼고도 테스트해보셨나요?
댓글 달기