Changeset 54cc2bf
- Timestamp:
- Jan 14, 2021, 7:42:53 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:
- f756a7f
- Parents:
- 7836dad (diff), 7222630 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- libcfa/src/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io/setup.cfa
r7836dad r54cc2bf 314 314 } 315 315 316 extern void __disable_interrupts_hard(); 317 extern void __enable_interrupts_hard(); 318 316 319 static void __io_create( __io_data & this, const io_context_params & params_in ) { 317 320 // Step 1 : call to setup … … 429 432 430 433 // Step 4 : eventfd 431 int efd; 432 for() { 433 efd = eventfd(0, 0); 434 if (efd < 0) { 435 if (errno == EINTR) continue; 436 abort("KERNEL ERROR: IO_URING EVENTFD - %s\n", strerror(errno)); 437 } 438 break; 439 } 440 441 int ret; 442 for() { 443 ret = syscall( __NR_io_uring_register, fd, IORING_REGISTER_EVENTFD, &efd, 1); 444 if (ret < 0) { 445 if (errno == EINTR) continue; 446 abort("KERNEL ERROR: IO_URING EVENTFD REGISTER - %s\n", strerror(errno)); 447 } 448 break; 449 } 434 // io_uring_register is so f*cking slow on some machine that it 435 // will never succeed if preemption isn't hard blocked 436 __disable_interrupts_hard(); 437 438 int efd = eventfd(0, 0); 439 if (efd < 0) { 440 abort("KERNEL ERROR: IO_URING EVENTFD - %s\n", strerror(errno)); 441 } 442 443 int ret = syscall( __NR_io_uring_register, fd, IORING_REGISTER_EVENTFD, &efd, 1); 444 if (ret < 0) { 445 abort("KERNEL ERROR: IO_URING EVENTFD REGISTER - %s\n", strerror(errno)); 446 } 447 448 __enable_interrupts_hard(); 450 449 451 450 // some paranoid checks -
libcfa/src/concurrency/preemption.cfa
r7836dad r54cc2bf 424 424 static void timeout( $thread * this ) { 425 425 unpark( this ); 426 } 427 428 void __disable_interrupts_hard() { 429 sigset_t oldset; 430 int ret; 431 ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary 432 if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); } 433 434 ret = sigismember(&oldset, SIGUSR1); 435 if(ret < 0) { abort("ERROR sigismember returned %d", ret); } 436 if(ret == 1) { abort("ERROR SIGUSR1 is disabled"); } 437 438 ret = sigismember(&oldset, SIGALRM); 439 if(ret < 0) { abort("ERROR sigismember returned %d", ret); } 440 if(ret == 0) { abort("ERROR SIGALRM is enabled"); } 441 442 signal_block( SIGUSR1 ); 443 } 444 445 void __enable_interrupts_hard() { 446 signal_unblock( SIGUSR1 ); 447 448 sigset_t oldset; 449 int ret; 450 ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary 451 if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); } 452 453 ret = sigismember(&oldset, SIGUSR1); 454 if(ret < 0) { abort("ERROR sigismember returned %d", ret); } 455 if(ret == 1) { abort("ERROR SIGUSR1 is disabled"); } 456 457 ret = sigismember(&oldset, SIGALRM); 458 if(ret < 0) { abort("ERROR sigismember returned %d", ret); } 459 if(ret == 0) { abort("ERROR SIGALRM is enabled"); } 426 460 } 427 461
Note: See TracChangeset
for help on using the changeset viewer.