Changeset 4fc3343
- Timestamp:
- Jan 18, 2021, 1:32:01 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 978e5eb, efdfdee
- Parents:
- 78a8440
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io/setup.cfa
r78a8440 r4fc3343 113 113 114 114 static struct { 115 pthread_t thrd; // pthread handle to io poller thread 116 void * stack; // pthread stack for io poller thread 117 int epollfd; // file descriptor to the epoll instance 118 volatile bool run; // Whether or not to continue 119 volatile size_t epoch; // Epoch used for memory reclamation 115 pthread_t thrd; // pthread handle to io poller thread 116 void * stack; // pthread stack for io poller thread 117 int epollfd; // file descriptor to the epoll instance 118 volatile bool run; // Whether or not to continue 119 volatile bool stopped; // Whether the poller has finished running 120 volatile uint64_t epoch; // Epoch used for memory reclamation 120 121 } iopoll; 121 122 … … 130 131 __cfadbg_print_safe(io_core, "Kernel : Starting io poller thread\n" ); 131 132 132 iopoll.run = true; 133 iopoll.stack = __create_pthread( &iopoll.thrd, iopoll_loop, 0p ); 134 iopoll.epoch = 0; 133 iopoll.stack = __create_pthread( &iopoll.thrd, iopoll_loop, 0p ); 134 iopoll.run = true; 135 iopoll.stopped = false; 136 iopoll.epoch = 0; 135 137 } 136 138 … … 205 207 } 206 208 } 209 210 __atomic_store_n(&iopoll.stopped, true, __ATOMIC_SEQ_CST); 207 211 208 212 __cfadbg_print_safe(io_core, "Kernel : IO poller thread stopping\n" ); … … 536 540 537 541 // Wait for the next epoch 538 while(curr == __atomic_load_n(&iopoll.epoch, __ATOMIC_RELAXED)) yield();542 while(curr == iopoll.epoch && !iopoll.stopped) Pause(); 539 543 } 540 544
Note: See TracChangeset
for help on using the changeset viewer.