Changeset 22226e4 for libcfa/src/concurrency/kernel/startup.cfa
- Timestamp:
- Mar 18, 2022, 12:42:39 PM (2 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 0b4ddb71, 51239d1b
- Parents:
- 3bc69f2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/startup.cfa
r3bc69f2 r22226e4 33 33 // CFA Includes 34 34 #include "kernel/private.hfa" 35 #include "iofwd.hfa" 35 36 #include "startup.hfa" // STARTUP_PRIORITY_XXX 36 37 #include "limits.hfa" … … 97 98 extern void __kernel_alarm_startup(void); 98 99 extern void __kernel_alarm_shutdown(void); 100 extern void __cfa_io_start( processor * ); 101 extern void __cfa_io_stop ( processor * ); 99 102 100 103 //----------------------------------------------------------------------------- … … 111 114 KERNEL_STORAGE(__stack_t, mainThreadCtx); 112 115 KERNEL_STORAGE(__scheduler_RWLock_t, __scheduler_lock); 116 KERNEL_STORAGE(eventfd_t, mainIdleEventFd); 117 KERNEL_STORAGE(io_future_t, mainIdleFuture); 113 118 #if !defined(__CFA_NO_STATISTICS__) 114 119 KERNEL_STORAGE(__stats_t, mainProcStats); … … 224 229 (*mainProcessor){}; 225 230 231 mainProcessor->idle_wctx.rdbuf = &storage_mainIdleEventFd; 232 mainProcessor->idle_wctx.ftr = (io_future_t*)&storage_mainIdleFuture; 233 /* paranoid */ verify( sizeof(storage_mainIdleEventFd) == sizeof(eventfd_t) ); 234 226 235 register_tls( mainProcessor ); 236 __cfa_io_start( mainProcessor ); 227 237 228 238 // Start by initializing the main thread … … 304 314 mainProcessor->local_data = 0p; 305 315 316 __cfa_io_stop( mainProcessor ); 306 317 unregister_tls( mainProcessor ); 307 318 … … 355 366 register_tls( proc ); 356 367 368 __cfa_io_start( proc ); 369 370 // used for idle sleep when io_uring is present 371 io_future_t future; 372 eventfd_t idle_buf; 373 proc->idle_wctx.ftr = &future; 374 proc->idle_wctx.rdbuf = &idle_buf; 375 376 357 377 // SKULLDUGGERY: We want to create a context for the processor coroutine 358 378 // which is needed for the 2-step context switch. However, there is no reason … … 381 401 // Main routine of the core returned, the core is now fully terminated 382 402 __cfadbg_print_safe(runtime_core, "Kernel : core %p main ended (%p)\n", proc, &proc->runner); 403 404 __cfa_io_stop( proc ); 383 405 384 406 #if !defined(__CFA_NO_STATISTICS__) … … 532 554 this.local_data = 0p; 533 555 534 this.idle_fd = eventfd(0, 0);535 if (idle_ fd < 0) {556 idle_wctx.evfd = eventfd(0, 0); 557 if (idle_wctx.evfd < 0) { 536 558 abort("KERNEL ERROR: PROCESSOR EVENTFD - %s\n", strerror(errno)); 537 559 } 538 560 539 this.idle_wctx.fd= 0;561 idle_wctx.sem = 0; 540 562 541 563 // I'm assuming these two are reserved for standard input and output 542 564 // so I'm using them as sentinels with idle_wctx. 543 /* paranoid */ verify( this.idle_fd != 0 );544 /* paranoid */ verify( this.idle_fd != 1 );565 /* paranoid */ verify( idle_wctx.evfd != 0 ); 566 /* paranoid */ verify( idle_wctx.evfd != 1 ); 545 567 546 568 #if !defined(__CFA_NO_STATISTICS__) … … 554 576 // Not a ctor, it just preps the destruction but should not destroy members 555 577 static void deinit(processor & this) { 556 close(this.idle_ fd);578 close(this.idle_wctx.evfd); 557 579 } 558 580
Note: See TracChangeset
for help on using the changeset viewer.