This is an automated email from the ASF dual-hosted git repository.
rduan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git
The following commit(s) were added to refs/heads/master by this push:
new 16e8de45 Fixed ordering
16e8de45 is described below
commit 16e8de4531d9cdd69258cbf3daa9d7fa16863549
Author: Dmons <[email protected]>
AuthorDate: Fri Mar 17 22:39:59 2023 +0800
Fixed ordering
---
samplecode/localattestation/attestation/src/func.rs | 6 +++---
samplecode/psi/SMCServer/enclave/src/lib.rs | 6 +++---
samplecode/thread/enclave/src/lib.rs | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/samplecode/localattestation/attestation/src/func.rs
b/samplecode/localattestation/attestation/src/func.rs
index cb40533a..23dae480 100644
--- a/samplecode/localattestation/attestation/src/func.rs
+++ b/samplecode/localattestation/attestation/src/func.rs
@@ -48,15 +48,15 @@ extern {
static CALLBACK_FN: AtomicPtr<()> = AtomicPtr::new(0 as * mut ());
pub fn init(cb: Callback) {
- let ptr = CALLBACK_FN.load(Ordering::SeqCst);
+ let ptr = CALLBACK_FN.load(Ordering::Relaxed);
if ptr.is_null() {
let ptr: * mut Callback = Box::into_raw(Box::new(cb));
- CALLBACK_FN.store(ptr as * mut (), Ordering::SeqCst);
+ CALLBACK_FN.store(ptr as * mut (), Ordering::Relaxed);
}
}
fn get_callback() -> Option<&'static Callback>{
- let ptr = CALLBACK_FN.load(Ordering::SeqCst) as *mut Callback;
+ let ptr = CALLBACK_FN.load(Ordering::Relaxed) as *mut Callback;
if ptr.is_null() {
return None;
}
diff --git a/samplecode/psi/SMCServer/enclave/src/lib.rs
b/samplecode/psi/SMCServer/enclave/src/lib.rs
index 59eabecd..b35d25ed 100644
--- a/samplecode/psi/SMCServer/enclave/src/lib.rs
+++ b/samplecode/psi/SMCServer/enclave/src/lib.rs
@@ -85,7 +85,7 @@ static GLOBAL_HASH_BUFFER: AtomicPtr<()> = AtomicPtr::new(0
as * mut ());
fn get_ref_hash_buffer() -> Option<&'static RefCell<SetIntersection>>
{
- let ptr = GLOBAL_HASH_BUFFER.load(Ordering::SeqCst) as * mut
RefCell<SetIntersection>;
+ let ptr = GLOBAL_HASH_BUFFER.load(Ordering::Relaxed) as * mut
RefCell<SetIntersection>;
if ptr.is_null() {
None
} else {
@@ -107,7 +107,7 @@ fn initialize() -> sgx_status_t {
let data_box = Box::new(RefCell::<SetIntersection>::new(data));
let ptr = Box::into_raw(data_box);
- GLOBAL_HASH_BUFFER.store(ptr as *mut (), Ordering::SeqCst);
+ GLOBAL_HASH_BUFFER.store(ptr as *mut (), Ordering::Relaxed);
sgx_status_t::SGX_SUCCESS
}
@@ -116,7 +116,7 @@ fn initialize() -> sgx_status_t {
pub extern "C"
fn uninitialize() {
- let ptr = GLOBAL_HASH_BUFFER.swap(0 as * mut (), Ordering::SeqCst) as *
mut RefCell<SetIntersection>;
+ let ptr = GLOBAL_HASH_BUFFER.swap(0 as * mut (), Ordering::Relaxed) as *
mut RefCell<SetIntersection>;
if ptr.is_null() {
return;
}
diff --git a/samplecode/thread/enclave/src/lib.rs
b/samplecode/thread/enclave/src/lib.rs
index 7b7f1bdc..7e7ea197 100644
--- a/samplecode/thread/enclave/src/lib.rs
+++ b/samplecode/thread/enclave/src/lib.rs
@@ -59,12 +59,12 @@ pub extern "C" fn ecall_initialize() {
SgxCondvar::new(),
));
let ptr = Box::into_raw(lock);
- GLOBAL_COND_BUFFER.store(ptr as *mut (), Ordering::SeqCst);
+ GLOBAL_COND_BUFFER.store(ptr as *mut (), Ordering::Relaxed);
}
#[no_mangle]
pub extern "C" fn ecall_uninitialize() {
- let ptr = GLOBAL_COND_BUFFER.swap(0 as *mut (), Ordering::SeqCst)
+ let ptr = GLOBAL_COND_BUFFER.swap(0 as *mut (), Ordering::Relaxed)
as *mut (SgxMutex<CondBuffer>, SgxCondvar, SgxCondvar);
if ptr.is_null() {
return;
@@ -73,7 +73,7 @@ pub extern "C" fn ecall_uninitialize() {
}
fn get_ref_cond_buffer() -> Option<&'static (SgxMutex<CondBuffer>, SgxCondvar,
SgxCondvar)> {
- let ptr = GLOBAL_COND_BUFFER.load(Ordering::SeqCst)
+ let ptr = GLOBAL_COND_BUFFER.load(Ordering::Relaxed)
as *mut (SgxMutex<CondBuffer>, SgxCondvar, SgxCondvar);
if ptr.is_null() {
None
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]