From: Brian Norris Date: Wed, 10 Oct 2012 18:41:38 +0000 (-0700) Subject: threads: correct 'thrd_yield()' X-Git-Tag: pldi2013~61 X-Git-Url: http://demsky.eecs.uci.edu/git/?p=model-checker.git;a=commitdiff_plain;h=26d1dd1430da05b8da4b1250b299a620ecd52102 threads: correct 'thrd_yield()' The C11 thrd_yield() interface should return void. Also, it doesn't need to do anything in our model-checker for now. I'm leaving its implementation commented out for now, in case we find it helps for fairness, for instance. Note that I made its location parameter non-NULL now, too, so that we can identify the Thread, if we ever use it. --- diff --git a/include/threads.h b/include/threads.h index 641b0cf..d1ff192 100644 --- a/include/threads.h +++ b/include/threads.h @@ -15,7 +15,7 @@ extern "C" { int thrd_create(thrd_t *t, thrd_start_t start_routine, void *arg); int thrd_join(thrd_t); - int thrd_yield(void); + void thrd_yield(void); thrd_t thrd_current(void); int user_main(int, char**); diff --git a/libthreads.cc b/libthreads.cc index 2b2bf85..05cca86 100644 --- a/libthreads.cc +++ b/libthreads.cc @@ -27,10 +27,10 @@ int thrd_join(thrd_t t) return 0; } -int thrd_yield(void) +/** A no-op, for now */ +void thrd_yield(void) { - /* seq_cst is just a 'don't care' parameter */ - return model->switch_to_master(new ModelAction(THREAD_YIELD, std::memory_order_seq_cst, NULL, VALUE_NONE)); + //model->switch_to_master(new ModelAction(THREAD_YIELD, std::memory_order_seq_cst, thread_current(), VALUE_NONE)); } thrd_t thrd_current(void)