projects
/
c11tester.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
02873e7
)
Implement both pthread_yield and c++ thread yield
author
weiyu
<weiyuluo1232@gmail.com>
Wed, 20 Nov 2019 20:40:46 +0000
(12:40 -0800)
committer
weiyu
<weiyuluo1232@gmail.com>
Wed, 20 Nov 2019 20:40:46 +0000
(12:40 -0800)
pthread.cc
patch
|
blob
|
history
diff --git
a/pthread.cc
b/pthread.cc
index d6067eb20fdafb70f04a8378150ba479f3465fd8..4b5e3d37963dc3887bcfa24d764375c4d479f654 100644
(file)
--- a/
pthread.cc
+++ b/
pthread.cc
@@
-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);