39,8 → 39,6 |
int a; |
atomic_t ftx; |
|
int __thread tls_prom; |
|
extern void utest(void *arg); |
void utest(void *arg) |
{ |
257,14 → 255,11 |
|
static int ptest(void *arg) |
{ |
tls_prom = -1; |
printf("Pseudo thread stage%d.\n", -tls_prom); |
tls_prom = -2; |
printf("Pseudo thread stage1.\n"); |
psthread_schedule_next(); |
printf("Pseudo thread stage%d.\n", -tls_prom); |
tls_prom = -3; |
printf("Pseudo thread stage2.\n"); |
psthread_schedule_next(); |
printf("Pseudo thread stage%d\n", -tls_prom); |
printf("Pseudo thread stage3.\n"); |
psthread_schedule_next(); |
printf("Pseudo thread stage4.\n"); |
psthread_schedule_next(); |
295,7 → 290,7 |
|
if (futex_down(&ftx) < 0) |
printf("Futex failed.\n"); |
/* |
|
if ((tid = thread_create(utest, NULL, "utest")) != -1) { |
printf("Created thread tid=%d\n", tid); |
} |
303,7 → 298,7 |
if ((tid = thread_create(utest, NULL, "utest")) != -1) { |
printf("Created thread tid=%d\n", tid); |
} |
*/ |
|
int i; |
|
for (i = 0; i < 50000000; i++) |
312,17 → 307,12 |
if (futex_up(&ftx) < 0) |
printf("Futex failed.\n"); |
|
|
printf("Creating pathread\n"); |
tls_prom = 1; |
ptid = psthread_create(ptest, NULL); |
printf("Main thread stage%d\n",tls_prom); |
tls_prom = 2; |
printf("Main thread stage1.\n"); |
psthread_schedule_next();; |
printf("Main thread stage%d\n", tls_prom); |
tls_prom = 3; |
printf("Main thread stage2.\n"); |
psthread_schedule_next();; |
printf("Main thread stage%d\n", tls_prom); |
printf("Main thread stage3.\n"); |
|
psthread_join(ptid); |
|