os-70-350

os-70-350 Commit Details


Date:2013-12-15 00:22:12 (11 years 8 months ago)
Author:Natalie Adams
Branch:master
Commit:36d330c4361589264ab1945b48bffc7741df56ee
Parents: 3e6b179b551503df74072568599ed1c451902e4a
Message:Adding a Linux thread example

Changes:

File differences

thread-linux/build.sh
1
2
3
4
#!/bin/bash
gcc -o main main.c
./main
thread-linux/main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
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;
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.20670s using 14 queries.