Merge branch 'branch-weiyu' of ssh://plrg.eecs.uci.edu:/home/git/random-fuzzer into...
authorbdemsky <bdemsky@uci.edu>
Tue, 26 Nov 2019 05:51:11 +0000 (21:51 -0800)
committerbdemsky <bdemsky@uci.edu>
Tue, 26 Nov 2019 05:51:11 +0000 (21:51 -0800)
pthread.cc

index d6067eb..4b5e3d3 100644 (file)
@@ -52,6 +52,12 @@ int pthread_detach(pthread_t t) {
        return 0;
 }
 
+/* Take care of both pthread_yield and c++ thread yield */
+int sched_yield() {
+       model->switch_to_master(new ModelAction(THREAD_YIELD, std::memory_order_seq_cst, thread_current(), VALUE_NONE));
+       return 0;
+}
+
 void pthread_exit(void *value_ptr) {
        Thread * th = thread_current();
        th->set_pthread_return(value_ptr);