2022-06-29 07:21:35 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <threads.h>
|
|
|
|
#include <stdatomic.h>
|
|
|
|
|
|
|
|
atomic_int acnt;
|
|
|
|
int cnt;
|
|
|
|
|
|
|
|
int f(void* thr_data)
|
|
|
|
{
|
2023-02-15 09:54:58 +00:00
|
|
|
for(int n = 0; n < 5; ++n)
|
|
|
|
puts("b");
|
2022-06-29 07:21:35 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2023-02-15 09:54:58 +00:00
|
|
|
thrd_t thread;
|
|
|
|
int status = thrd_create(&thread, f, NULL);
|
|
|
|
if(status == thrd_error) {
|
|
|
|
puts("Failed creating threads");
|
|
|
|
}
|
|
|
|
for(int n = 0; n < 5; ++n) {
|
|
|
|
puts("a");
|
|
|
|
}
|
|
|
|
int res;
|
|
|
|
if(thrd_join(thread, &res) == thrd_error) {
|
|
|
|
puts("Failed waiting on thread");
|
|
|
|
}
|
|
|
|
puts("Finished");
|
2022-06-29 07:21:35 +00:00
|
|
|
}
|