/* simple threads tests * */ #include #include #include int x=42; void bogey(char *a) { int i; i = m_get_myid(); /* i is on the stack */ m_sync(); /* after sync all have a value i */ m_lock(); printf("I'm process %d\n", i); x = i; /* there is only one x */ m_unlock(); m_sync(); m_lock(); printf("x is %d\n", x); m_unlock(); } main (int argc, char *argv[]) { m_set_procs(4); m_fork(bogey, "bogey string"); }