mirror of
https://sourceware.org/git/glibc.git
synced 2026-01-06 11:51:29 +03:00
* Examples/ex13.c: Make local functions static.
* ecmutex.c: Likewise. * Examples/ex14.c: Likewise. * Examples/ex2.c: Make local functions static; reformat. * Examples/ex1.c: Likewise. * Examples/ex4.c: Likewise. * Examples/ex5.c: Likewise. * Examples/ex7.c: Likewise. CVS ----------------------------------------------------------------------
This commit is contained in:
@@ -9,32 +9,37 @@
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define NTHREADS 20 /* number of threads */
|
||||
#define NTHREADS 20 /* number of threads */
|
||||
|
||||
static void *thread(void *arg)
|
||||
static void *
|
||||
thread (void *arg)
|
||||
{
|
||||
printf("thread terminating\n");
|
||||
printf ("thread terminating\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cleanup(void)
|
||||
static void
|
||||
cleanup (void)
|
||||
{
|
||||
printf("atexit handler called\n");
|
||||
printf ("atexit handler called\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
atexit(cleanup);
|
||||
atexit (cleanup);
|
||||
|
||||
for (i = 0; i < NTHREADS; i++) {
|
||||
pthread_t id;
|
||||
if (pthread_create(&id, 0, thread, 0) != 0) {
|
||||
fprintf(stderr, "pthread_create failed\n");
|
||||
abort();
|
||||
for (i = 0; i < NTHREADS; i++)
|
||||
{
|
||||
pthread_t id;
|
||||
if (pthread_create (&id, 0, thread, 0) != 0)
|
||||
{
|
||||
fprintf (stderr, "pthread_create failed\n");
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pthread_exit(0);
|
||||
pthread_exit (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user