Açıklama Yok
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main-race.c 321B

123456789101112131415161718
  1. #include <stdio.h>
  2. #include "mythreads.h"
  3. int balance = 0;
  4. void* worker(void* arg) {
  5. balance++; // unprotected access
  6. return NULL;
  7. }
  8. int main(int argc, char *argv[]) {
  9. pthread_t p;
  10. Pthread_create(&p, NULL, worker, NULL);
  11. balance++; // unprotected access
  12. Pthread_join(p, NULL);
  13. return 0;
  14. }