@@ -9,7 +9,7 @@ use crate::cell::UnsafeCell;
9
9
use crate :: marker:: PhantomData ;
10
10
use crate :: mem:: MaybeUninit ;
11
11
use crate :: ptr;
12
- use crate :: sync:: atomic:: { self , AtomicPtr , AtomicUsize , Ordering } ;
12
+ use crate :: sync:: atomic:: { self , Atomic , AtomicPtr , AtomicUsize , Ordering } ;
13
13
use crate :: time:: Instant ;
14
14
15
15
// Bits indicating the state of a slot:
@@ -37,7 +37,7 @@ struct Slot<T> {
37
37
msg : UnsafeCell < MaybeUninit < T > > ,
38
38
39
39
/// The state of the slot.
40
- state : AtomicUsize ,
40
+ state : Atomic < usize > ,
41
41
}
42
42
43
43
impl < T > Slot < T > {
@@ -55,7 +55,7 @@ impl<T> Slot<T> {
55
55
/// Each block in the list can hold up to `BLOCK_CAP` messages.
56
56
struct Block < T > {
57
57
/// The next block in the linked list.
58
- next : AtomicPtr < Block < T > > ,
58
+ next : Atomic < * mut Block < T > > ,
59
59
60
60
/// Slots for messages.
61
61
slots : [ Slot < T > ; BLOCK_CAP ] ,
@@ -65,11 +65,11 @@ impl<T> Block<T> {
65
65
/// Creates an empty block.
66
66
fn new ( ) -> Box < Block < T > > {
67
67
// SAFETY: This is safe because:
68
- // [1] `Block::next` (AtomicPtr ) may be safely zero initialized.
68
+ // [1] `Block::next` (Atomic<*mut _> ) may be safely zero initialized.
69
69
// [2] `Block::slots` (Array) may be safely zero initialized because of [3, 4].
70
70
// [3] `Slot::msg` (UnsafeCell) may be safely zero initialized because it
71
71
// holds a MaybeUninit.
72
- // [4] `Slot::state` (AtomicUsize ) may be safely zero initialized.
72
+ // [4] `Slot::state` (Atomic<usize> ) may be safely zero initialized.
73
73
unsafe { Box :: new_zeroed ( ) . assume_init ( ) }
74
74
}
75
75
@@ -110,10 +110,10 @@ impl<T> Block<T> {
110
110
#[ derive( Debug ) ]
111
111
struct Position < T > {
112
112
/// The index in the channel.
113
- index : AtomicUsize ,
113
+ index : Atomic < usize > ,
114
114
115
115
/// The block in the linked list.
116
- block : AtomicPtr < Block < T > > ,
116
+ block : Atomic < * mut Block < T > > ,
117
117
}
118
118
119
119
/// The token type for the list flavor.
0 commit comments