Subj : Futex problem To : comp.programming.threads From : JK Date : Sat Oct 01 2005 08:58 am Hi, I am trying to learn how to use futex and I just dont get it ;) What is problem with this code example? The child process never stops waiting. This is only a test, thats why it does not have any error checking. #include #include #include #include #include #include #include #define __NR_sys_futex __NR_futex _syscall4(int, sys_futex, volatile int *, futex, int, op, int, val, struct timespec *, rel); int main(int argc, char *argv[]) { int counter = 1; pid_t p = fork(); if (p == 0) { printf ("before wait\n"); sys_futex(&counter, FUTEX_WAIT, 1, NULL); printf ("after wait\n"); } sleep (2); counter = 0; printf ("wake (%d) : %d\n", sys_futex(&counter, FUTEX_WAKE, 1, NULL), counter); sleep (2); return EXIT_SUCCESS; } OUPUT: ---------------- before wait wake (0) : 0 Thanks, JK .