/* 2005/04/04 (c) ymlib.com */ /* pthread_createでスレッドを生成し、スレッドの終了を待つ */ #include #include #include extern void* myThread( void* ); int main( int argc, char** argv ) { pthread_t tid = 0x00; int ret = 0; printf( "LC001_main start!!\n" ); /* スレッドの生成 */ ret = pthread_create( &tid, NULL, myThread, NULL ); if ( ret != 0 ) { /* スレッド生成失敗 */ printf( "pthread_create failed!!=[%d]\n", ret ); exit( -1 ); } printf( "thread ID=[%ld]\n", tid ); /* スレッドの終了を待つ */ pthread_join( tid, NULL ); printf( "LC001_main end!!\n" ); return( 0 ); }