Fix compilation warnings by adding unistd.h #include and missing return
statements MFC after: 3 days Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
eff763d5bc
commit
75743a83e4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=291983
@ -1,7 +1,8 @@
|
|||||||
/* $FreeBSD$ */
|
/* $FreeBSD$ */
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
int __thread i;
|
int __thread i;
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ foo1(void *arg)
|
|||||||
printf("thread %p, i = %d\n", pthread_self(), i);
|
printf("thread %p, i = %d\n", pthread_self(), i);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
@ -23,9 +25,11 @@ foo2(void *arg)
|
|||||||
printf("thread %p, i = %d\n", pthread_self(), i);
|
printf("thread %p, i = %d\n", pthread_self(), i);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int
|
||||||
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
pthread_t t1, t2;
|
pthread_t t1, t2;
|
||||||
|
|
||||||
@ -33,4 +37,6 @@ int main(int argc, char** argv)
|
|||||||
pthread_create(&t2, 0, foo2, 0);
|
pthread_create(&t2, 0, foo2, 0);
|
||||||
pthread_join(t1, 0);
|
pthread_join(t1, 0);
|
||||||
pthread_join(t2, 0);
|
pthread_join(t2, 0);
|
||||||
|
|
||||||
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user