⚲
Project
General
Profile
Sign in
Home
Projects
Help
Search
:
DragonFlyBSD
All Projects
DragonFlyBSD
Overview
Activity
Roadmap
Issues
Documents
Files
Repository
Download (709 Bytes)
Bug #1343
» test5.c
alexh
, 04/23/2009 05:40 PM
#include
<stdio.h>
#include
<stdlib.h>
#include
<pthread.h>
#include
<sys/types.h>
#include
<dirent.h>
#include
<errno.h>
#include
<unistd.h>
void
*
tester
(
void
*
arg
)
{
for
(;;)
sleep
(
1
);
}
void
*
checker
(
void
*
arg
)
{
printf
(
"Passed barrier!
\n
"
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
i
,
ret
,
nthreads
;
pthread_t
th
;
if
(
argc
<=
1
)
{
printf
(
"Need one argument
\n
"
);
exit
(
1
);
}
nthreads
=
atoi
(
argv
[
1
]);
printf
(
"Trying with %d threads
\n
"
,
nthreads
);
printf
(
"Creating checker thread
\n
"
);
pthread_create
(
&
th
,
NULL
,
checker
,
NULL
);
printf
(
"Creating tester threads
\n
"
);
for
(
i
=
0
;
i
<
nthreads
;
i
++
)
pthread_create
(
&
th
,
NULL
,
tester
,
NULL
);
sleep
(
1
);
getchar
();
return
0
;
}
« Previous
1
2
3
Next »
(3-3/3)
Loading...