1 /* BeginSourceFile more_steps.c
3 This file creates a lot of threads which then execute
4 in parallel, so that wdb can be tested on handling
5 simultaneous thread events.
9 cc -Ae +DA1.0 -g -o more_steps -lpthread more_steps.c
34 /* Uncomment to turn on debugging output */
39 int lock_one
; /* Main W, others R */
40 int lock_two
; /* ditto */
41 int lock_end
[ N_THREADS
]; /* Main R, others R[i] */
42 int phase
[ N_THREADS
];
44 /* Routine for each thread to run.
52 lock_end
[ me
] = TRUE
;
64 lock_end
[ me
] = FALSE
;
71 pthread_t t
[ N_THREADS
];
75 /* Start N_THREADS threads, then join them so
76 * that they are terminated.
78 for( i
= 0; i
< N_THREADS
; i
++ ) {
79 err
= pthread_create( &t
[i
], NULL
, spin
, (void *)i
);
81 printf( "== Start/stop, error in thread %d create\n", i
);
101 for( i
= 0; i
< N_THREADS
; i
++ ) {
103 /* Thread "i" is not ready yet.
113 for( i
= 0; i
< N_THREADS
; i
++ ) {
114 err
= pthread_join(t
[i
], NULL
); /* Line 105 */
115 if( err
!= 0 ) { /* Line 106 */
116 printf( "== Start/stop, error in thread %d join\n", i
);
120 i
= 10; /* Line 109. Null line for setting bpts on. */
133 for( i
= 0; i
< N_THREADS
; i
++ ) {
This page took 0.040232 seconds and 4 git commands to generate.