Skip to content

Commit 620c9d5

Browse files
committed
compare_exchange_weak doesn't work.
1 parent adee687 commit 620c9d5

File tree

1 file changed

+4
-4
lines changed
  • library/std/src/sys/unix/freertos

1 file changed

+4
-4
lines changed

library/std/src/sys/unix/freertos/mutex.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl Mutex {
3333
#[inline]
3434
unsafe fn atomic_init(&self) {
3535
loop {
36-
match self.initialized.compare_exchange_weak(UNINITIALIZED, INITIALIZING, SeqCst, SeqCst) {
36+
match self.initialized.compare_exchange(UNINITIALIZED, INITIALIZING, SeqCst, SeqCst) {
3737
Ok(UNINITIALIZED) => {
3838
*self.inner.get() = xSemaphoreCreateMutex();
3939
debug_assert!(!(*self.inner.get()).is_null());
@@ -69,7 +69,7 @@ impl Mutex {
6969
#[inline]
7070
pub unsafe fn destroy(&self) {
7171
loop {
72-
match self.initialized.compare_exchange_weak(INITIALIZED, UNINITIALIZING, SeqCst, SeqCst) {
72+
match self.initialized.compare_exchange(INITIALIZED, UNINITIALIZING, SeqCst, SeqCst) {
7373
Ok(INITIALIZED) => {
7474
vSemaphoreDelete(*self.inner.get());
7575
*self.inner.get() = ptr::null_mut();
@@ -113,7 +113,7 @@ impl ReentrantMutex {
113113
#[inline]
114114
unsafe fn atomic_init(&self) {
115115
loop {
116-
match self.initialized.compare_exchange_weak(UNINITIALIZED, INITIALIZING, SeqCst, SeqCst) {
116+
match self.initialized.compare_exchange(UNINITIALIZED, INITIALIZING, SeqCst, SeqCst) {
117117
Ok(UNINITIALIZED) => {
118118
*self.inner.get() = xSemaphoreCreateRecursiveMutex();
119119
debug_assert!(!(*self.inner.get()).is_null());
@@ -147,7 +147,7 @@ impl ReentrantMutex {
147147

148148
pub unsafe fn destroy(&self) {
149149
loop {
150-
match self.initialized.compare_exchange_weak(INITIALIZED, UNINITIALIZING, SeqCst, SeqCst) {
150+
match self.initialized.compare_exchange(INITIALIZED, UNINITIALIZING, SeqCst, SeqCst) {
151151
Ok(INITIALIZED) => {
152152
vSemaphoreDelete(*self.inner.get());
153153
*self.inner.get() = ptr::null_mut();

0 commit comments

Comments
 (0)