File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
src/constance_port_std/src Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,11 @@ impl TaskState {
124
124
125
125
fn assert_current_thread ( & self ) {
126
126
// `self` must represent the current thread
127
- // TODO
127
+ let expected_thread_id = match & * self . tsm . lock ( ) {
128
+ Tsm :: Running ( thread_id) => * thread_id,
129
+ _ => unreachable ! ( ) ,
130
+ } ;
131
+ assert_eq ! ( ums:: current_thread( ) , Some ( expected_thread_id) ) ;
128
132
}
129
133
130
134
unsafe fn exit_and_dispatch ( & self , state : & ' static State ) -> ! {
Original file line number Diff line number Diff line change @@ -335,3 +335,8 @@ fn finalize_thread(
335
335
// Invoke the scheduler
336
336
state_guard. unpark_next_thread ( ) ;
337
337
}
338
+
339
+ /// Get the current worker thread.
340
+ pub fn current_thread ( ) -> Option < ThreadId > {
341
+ TLB . with ( |cell| cell. get ( ) . map ( |tlb| tlb. thread_id ) )
342
+ }
You can’t perform that action at this time.
0 commit comments