7 #define CHUNK_SIZE 16000 /* same as findcmd.c's */
8 #define BUF_SIZE (2 * CHUNK_SIZE) /* at least two chunks */
11 int8_t int8_search_buf
[100];
12 int16_t int16_search_buf
[100];
13 int32_t int32_search_buf
[100];
14 int64_t int64_search_buf
[100];
16 static char *search_buf
;
17 static int search_buf_size
;
22 /* We use a `char[]' type below rather than the typical `char *'
23 to make sure that `str' gets allocated on the stack. Otherwise,
24 the compiler may place the "hello, testsuite" string inside
25 a read-only section, preventing us from over-writing it from GDB. */
26 char str
[] = "hello, testsuite";
28 puts (str
); /* Break here. */
41 search_buf_size
= BUF_SIZE
;
42 search_buf
= malloc (search_buf_size
);
43 if (search_buf
== NULL
)
45 memset (search_buf
, 'x', search_buf_size
);
51 pthread_barrier_t
*barrier
= (pthread_barrier_t
*) param
;
53 pthread_barrier_wait (barrier
);
59 check_threads (pthread_barrier_t
*barrier
)
61 pthread_barrier_wait (barrier
);
67 pthread_t threads
[NUMTH
];
68 pthread_barrier_t barrier
;
71 pthread_barrier_init (&barrier
, NULL
, NUMTH
+ 1);
73 for (i
= 0; i
< NUMTH
; ++i
)
74 pthread_create (&threads
[i
], NULL
, thread
, &barrier
);
76 check_threads (&barrier
);
78 for (i
= 0; i
< NUMTH
; ++i
)
79 pthread_join (threads
[i
], NULL
);
81 pthread_barrier_destroy (&barrier
);
86 int main (int argc
, char *argv
[])