Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <pthread.h>
- #include <stdio.h>
- #include <stdlib.h>
- void *print( void* );
- int main( int argc, char *argv[] )
- {
- pthread_t threads[2];
- int rc;
- char* hello = "hello ";
- char* world = "world\n";
- rc = pthread_create( &threads[0], NULL, print, (void*)hello );
- if( rc ) exit( -1 );
- rc = pthread_create( &threads[1], NULL, print, (void*)world );
- if( rc ) exit( -1 );
- pthread_exit( NULL );
- }
- void *print( void* word )
- {
- char* w;
- w = (char*)word;
- printf( "%s", w );
- pthread_exit(NULL);
- }
- #ifdef __cplusplus
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement