Play and learn 300 000+ tabs online

Monday, August 9, 2010

Pthread Code

#include <stdio.h>
#include <pthread.h>
void * start
(
void * arg
)
{
printf( "I am a thread!\n" );
return NULL;
}
int main( int argc, char ** argv )
{
pthread_t thread;
pthread_attr_t attr;
pthread_attr_init( & attr );
pthread_attr_setdetachstate( & attr, PTHREAD_CREATE_JOINABLE );
pthread_create( & thread, & attr, & start, NULL );
pthread_join( thread, NULL );
return 0;
}



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.