77extern crate std;
88
99#[ cfg( feature = "use_spin" ) ]
10- extern crate spin ;
10+ extern crate spinning_top ;
1111
1212extern crate alloc;
1313
14- use alloc:: alloc:: { AllocRef , AllocErr , Layout } ;
15- use core:: alloc:: { GlobalAlloc } ;
14+ use alloc:: alloc:: { AllocErr , AllocRef , Layout } ;
15+ use core:: alloc:: GlobalAlloc ;
1616use core:: mem;
1717#[ cfg( feature = "use_spin" ) ]
1818use core:: ops:: Deref ;
1919use core:: ptr:: NonNull ;
2020use hole:: { Hole , HoleList } ;
2121#[ cfg( feature = "use_spin" ) ]
22- use spin :: Mutex ;
22+ use spinning_top :: Spinlock ;
2323
2424mod hole;
2525#[ cfg( test) ]
@@ -140,21 +140,21 @@ unsafe impl AllocRef for Heap {
140140}
141141
142142#[ cfg( feature = "use_spin" ) ]
143- pub struct LockedHeap ( Mutex < Heap > ) ;
143+ pub struct LockedHeap ( Spinlock < Heap > ) ;
144144
145145#[ cfg( feature = "use_spin" ) ]
146146impl LockedHeap {
147147 /// Creates an empty heap. All allocate calls will return `None`.
148148 pub const fn empty ( ) -> LockedHeap {
149- LockedHeap ( Mutex :: new ( Heap :: empty ( ) ) )
149+ LockedHeap ( Spinlock :: new ( Heap :: empty ( ) ) )
150150 }
151151
152152 /// Creates a new heap with the given `bottom` and `size`. The bottom address must be valid
153153 /// and the memory in the `[heap_bottom, heap_bottom + heap_size)` range must not be used for
154154 /// anything else. This function is unsafe because it can cause undefined behavior if the
155155 /// given address is invalid.
156156 pub unsafe fn new ( heap_bottom : usize , heap_size : usize ) -> LockedHeap {
157- LockedHeap ( Mutex :: new ( Heap {
157+ LockedHeap ( Spinlock :: new ( Heap {
158158 bottom : heap_bottom,
159159 size : heap_size,
160160 holes : HoleList :: new ( heap_bottom, heap_size) ,
@@ -164,9 +164,9 @@ impl LockedHeap {
164164
165165#[ cfg( feature = "use_spin" ) ]
166166impl Deref for LockedHeap {
167- type Target = Mutex < Heap > ;
167+ type Target = Spinlock < Heap > ;
168168
169- fn deref ( & self ) -> & Mutex < Heap > {
169+ fn deref ( & self ) -> & Spinlock < Heap > {
170170 & self . 0
171171 }
172172}
0 commit comments