Changeset 95dab9e for libcfa/src/concurrency
- Timestamp:
- Sep 21, 2022, 11:56:16 AM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- 9cd5bd2
- Parents:
- 7f6a7c9
- Location:
- libcfa/src/concurrency
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/clib/cfathread.cfa
r7f6a7c9 r95dab9e 172 172 173 173 pthread_attr_t attr; 174 if (int ret = real_pthread_attr_init(&attr); 0 != ret) {174 if (int ret = __cfaabi_pthread_attr_init(&attr); 0 != ret) { 175 175 abort | "failed to create master epoll thread attr: " | ret | strerror(ret); 176 176 } 177 177 178 if (int ret = real_pthread_create(&master_poller, &attr, master_epoll, 0p); 0 != ret) {178 if (int ret = __cfaabi_pthread_create(&master_poller, &attr, master_epoll, 0p); 0 != ret) { 179 179 abort | "failed to create master epoll thread: " | ret | strerror(ret); 180 180 } -
libcfa/src/concurrency/io.cfa
r7f6a7c9 r95dab9e 610 610 if( we ) { 611 611 sigval_t value = { PREEMPT_IO }; 612 real_pthread_sigqueue(ctx->proc->kernel_thread, SIGUSR1, value);612 __cfaabi_pthread_sigqueue(ctx->proc->kernel_thread, SIGUSR1, value); 613 613 } 614 614 -
libcfa/src/concurrency/io/setup.cfa
r7f6a7c9 r95dab9e 344 344 // iopoll.run = false; 345 345 // sigval val = { 1 }; 346 // real_pthread_sigqueue( iopoll.thrd, SIGUSR1, val );346 // __cfaabi_pthread_sigqueue( iopoll.thrd, SIGUSR1, val ); 347 347 348 348 // // Make sure all this is done -
libcfa/src/concurrency/kernel/private.hfa
r7f6a7c9 r95dab9e 49 49 #endif 50 50 51 extern "C" { 52 __attribute__((visibility("protected"))) int __cfaabi_pthread_create(pthread_t *_thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg); 53 __attribute__((visibility("protected"))) int __cfaabi_pthread_join(pthread_t _thread, void **retval); 54 __attribute__((visibility("protected"))) pthread_t __cfaabi_pthread_self(void); 55 __attribute__((visibility("protected"))) int __cfaabi_pthread_attr_init(pthread_attr_t *attr); 56 __attribute__((visibility("protected"))) int __cfaabi_pthread_attr_destroy(pthread_attr_t *attr); 57 __attribute__((visibility("protected"))) int __cfaabi_pthread_attr_setstack( pthread_attr_t *attr, void *stackaddr, size_t stacksize ); 58 __attribute__((visibility("protected"))) int __cfaabi_pthread_attr_getstacksize( const pthread_attr_t *attr, size_t *stacksize ); 59 __attribute__((visibility("protected"))) int __cfaabi_pthread_sigqueue(pthread_t _thread, int sig, const union sigval value); 60 __attribute__((visibility("protected"))) int __cfaabi_pthread_sigmask( int how, const sigset_t *set, sigset_t *oset); 61 } 62 51 63 //----------------------------------------------------------------------------- 52 64 // Scheduler -
libcfa/src/concurrency/kernel/startup.cfa
r7f6a7c9 r95dab9e 219 219 ( this.runner ){}; 220 220 init( this, "Main Processor", *mainCluster, 0p ); 221 kernel_thread = real_pthread_self();221 kernel_thread = __cfaabi_pthread_self(); 222 222 223 223 runner{ &this }; … … 779 779 pthread_attr_t attr; 780 780 781 check( real_pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute781 check( __cfaabi_pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute 782 782 783 783 size_t stacksize = max( PTHREAD_STACK_MIN, DEFAULT_STACK_SIZE ); … … 806 806 #endif 807 807 808 check( real_pthread_attr_setstack( &attr, stack, stacksize ), "pthread_attr_setstack" );809 check( real_pthread_create( pthread, &attr, start, arg ), "pthread_create" );808 check( __cfaabi_pthread_attr_setstack( &attr, stack, stacksize ), "pthread_attr_setstack" ); 809 check( __cfaabi_pthread_create( pthread, &attr, start, arg ), "pthread_create" ); 810 810 return stack; 811 811 } 812 812 813 813 void __destroy_pthread( pthread_t pthread, void * stack, void ** retval ) { 814 int err = real_pthread_join( pthread, retval );814 int err = __cfaabi_pthread_join( pthread, retval ); 815 815 if( err != 0 ) abort("KERNEL ERROR: joining pthread %p caused error %s\n", (void*)pthread, strerror(err)); 816 816 … … 818 818 pthread_attr_t attr; 819 819 820 check( real_pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute820 check( __cfaabi_pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute 821 821 822 822 size_t stacksize; 823 823 // default stack size, normally defined by shell limit 824 check( real_pthread_attr_getstacksize( &attr, &stacksize ), "pthread_attr_getstacksize" );824 check( __cfaabi_pthread_attr_getstacksize( &attr, &stacksize ), "pthread_attr_getstacksize" ); 825 825 assert( stacksize >= PTHREAD_STACK_MIN ); 826 826 stacksize += __page_size; -
libcfa/src/concurrency/preemption.cfa
r7f6a7c9 r95dab9e 406 406 sigset_t oldset; 407 407 int ret; 408 ret = real_pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary408 ret = __cfaabi_pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary 409 409 if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); } 410 410 … … 439 439 sigaddset( &mask, sig ); 440 440 441 if ( real_pthread_sigmask( SIG_UNBLOCK, &mask, 0p ) == -1 ) {441 if ( __cfaabi_pthread_sigmask( SIG_UNBLOCK, &mask, 0p ) == -1 ) { 442 442 abort( "internal error, pthread_sigmask" ); 443 443 } … … 450 450 sigaddset( &mask, sig ); 451 451 452 if ( real_pthread_sigmask( SIG_BLOCK, &mask, 0p ) == -1 ) {452 if ( __cfaabi_pthread_sigmask( SIG_BLOCK, &mask, 0p ) == -1 ) { 453 453 abort( "internal error, pthread_sigmask" ); 454 454 } … … 458 458 static void preempt( processor * this ) { 459 459 sigval_t value = { PREEMPT_NORMAL }; 460 real_pthread_sigqueue( this->kernel_thread, SIGUSR1, value );460 __cfaabi_pthread_sigqueue( this->kernel_thread, SIGUSR1, value ); 461 461 } 462 462 … … 469 469 sigset_t oldset; 470 470 int ret; 471 ret = real_pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary471 ret = __cfaabi_pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary 472 472 if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); } 473 473 … … 488 488 sigset_t oldset; 489 489 int ret; 490 ret = real_pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary490 ret = __cfaabi_pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary 491 491 if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); } 492 492 … … 559 559 sigval val; 560 560 val.sival_int = 0; 561 real_pthread_sigqueue( alarm_thread, SIGALRM, val );561 __cfaabi_pthread_sigqueue( alarm_thread, SIGALRM, val ); 562 562 563 563 // Wait for the preemption thread to finish … … 633 633 static_assert( sizeof( sigset_t ) == sizeof( cxt->uc_sigmask ), "Expected cxt->uc_sigmask to be of sigset_t" ); 634 634 #endif 635 if ( real_pthread_sigmask( SIG_SETMASK, (sigset_t *)&(cxt->uc_sigmask), 0p ) == -1 ) {635 if ( __cfaabi_pthread_sigmask( SIG_SETMASK, (sigset_t *)&(cxt->uc_sigmask), 0p ) == -1 ) { 636 636 abort( "internal error, sigprocmask" ); 637 637 } … … 661 661 sigset_t mask; 662 662 sigfillset(&mask); 663 if ( real_pthread_sigmask( SIG_BLOCK, &mask, 0p ) == -1 ) {663 if ( __cfaabi_pthread_sigmask( SIG_BLOCK, &mask, 0p ) == -1 ) { 664 664 abort( "internal error, pthread_sigmask" ); 665 665 }
Note: See TracChangeset
for help on using the changeset viewer.