int main(int argc, char** argv)
{
+ const struct timespec delay = { 0, 100 * 1000 * 1000 };
int optchar;
int ign_rw = 1;
pthread_t tid;
}
pthread_create(&tid, 0, thread_func, 0);
+
+ nanosleep(&delay, 0);
+
if (ign_rw)
ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN();
/* Read s_b and modify s_a. */
int main(int argc, char** argv)
{
+ const struct timespec delay = { 0, 100 * 1000 * 1000 };
int optchar;
int ign_rw = 1;
pthread_t tid;
}
pthread_create(&tid, 0, thread_func, 0);
+
+ /* Let the code in the created thread run first. */
+ nanosleep(&delay, 0);
+
if (ign_rw)
ANNOTATE_IGNORE_WRITES_BEGIN();
/* Read s_b and modify s_a. */
* Insert a delay here in order to make sure the load of s_c happens
* after s_c has been modified.
*/
- sleep(1);
+ nanosleep(&delay, 0);
/* Read s_c and modify s_a. */
s_a = s_c;