diff --git a/thread-linux/build.sh b/thread-linux/build.sh new file mode 100644 index 0000000..e2164d8 --- /dev/null +++ b/thread-linux/build.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +gcc -o main main.c +./main \ No newline at end of file diff --git a/thread-linux/main.c b/thread-linux/main.c new file mode 100644 index 0000000..ddc0ae4 --- /dev/null +++ b/thread-linux/main.c @@ -0,0 +1,23 @@ +#include +#include +#include + +void *print_message_function( void *ptr ) +{ + int i; + for(i = 0; i < 10; i++) + printf("%i", i); +} + +int main() +{ + pthread_t thread1, thread2; + int iret1, iret2; + iret1 = pthread_create( &thread1, NULL, print_message_function, NULL); + iret2 = pthread_create( &thread2, NULL, print_message_function, NULL); + + pthread_join( thread1, NULL); + pthread_join( thread2, NULL); + + return 0; +} \ No newline at end of file