Does pthread_mutex_lock have happens-before semantics
问题 threadA go through this snippet { global_a = 100; // 1 { pthread_mutex_lock(&b_mutex) ... pthread_mutex_unlock(&b_mutex) } // 2 } threadB go through this snippet { { pthread_mutex_lock(&b_mutex) ... pthread_mutex_unlock(&b_mutex) } // 3 int tmp = global_a; // 4 } and suppose that from an observer view the execution sequence indeed is threadA --- 1 threadA --- 2 threadB --- 3 threadB --- 4 Can the code at threadB "int tmp = global_a;" see what threadA set at "global_a = 100;" ? Any suggestion