Fix the example in chapter 6 to compile

Before we introduced the better `Parker` we were using a thread. The example code for executor need to use `thread` instead of `parker`
This commit is contained in:
Tony-X
2022-01-24 18:24:09 -08:00
committed by GitHub
parent 80d32c612d
commit 8e1bb6bcd9

View File

@@ -168,7 +168,7 @@ const VTABLE: RawWakerVTable = unsafe {
RawWakerVTable::new(
|s| mywaker_clone(&*(s as *const MyWaker)), // clone
|s| mywaker_wake(&*(s as *const MyWaker)), // wake
|s| (*(s as *const MyWaker)).parker.unpark(), // wake by ref (don't decrease refcount)
|s| (*(s as *const MyWaker)).thread.unpark(), // wake by ref (don't decrease refcount)
|s| drop(Arc::from_raw(s as *const MyWaker)), // decrease refcount
)
};