about summary refs log tree commit diff
path: root/src/libstd/sys/sgx/condvar.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-16 17:08:56 -0700
committerGitHub <noreply@github.com>2020-07-16 17:08:56 -0700
commit41d956bf632fbc658f21a4195344fe79b685cde9 (patch)
tree24b2fbdfb120b84814d6b1bd996e6dba940fd15e /src/libstd/sys/sgx/condvar.rs
parentec93d566b3ef29d5b97acca520558b5b05104f20 (diff)
parent85c25aed510ce599504b172f7c7bef280e91637b (diff)
downloadrust-41d956bf632fbc658f21a4195344fe79b685cde9.tar.gz
rust-41d956bf632fbc658f21a4195344fe79b685cde9.zip
Rollup merge of #73269 - mzohreva:mz/sgx-wait-timeout, r=jethrogb
Enable some timeouts in SGX platform

This would partially resolve https://github.com/fortanix/rust-sgx/issues/31

cc @jethrogb and @Goirad
Diffstat (limited to 'src/libstd/sys/sgx/condvar.rs')
-rw-r--r--src/libstd/sys/sgx/condvar.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstd/sys/sgx/condvar.rs b/src/libstd/sys/sgx/condvar.rs
index 9c5c086184d..ed6dbcf4971 100644
--- a/src/libstd/sys/sgx/condvar.rs
+++ b/src/libstd/sys/sgx/condvar.rs
@@ -31,8 +31,10 @@ impl Condvar {
         mutex.lock()
     }
 
-    pub unsafe fn wait_timeout(&self, _mutex: &Mutex, _dur: Duration) -> bool {
-        rtabort!("timeout not supported in SGX");
+    pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool {
+        let success = WaitQueue::wait_timeout(&self.inner, dur, || mutex.unlock());
+        mutex.lock();
+        success
     }
 
     #[inline]