Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/preemption.cfa

    r27f5f71 r1805b1b  
    1010// Created On       : Mon Jun 5 14:20:42 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Nov 30 08:02:56 2019
    13 // Update Count     : 39
     12// Last Modified On : Sun Dec  1 22:22:56 2019
     13// Update Count     : 41
    1414//
    1515
     
    306306        signal_block( SIGALRM );
    307307
    308         pthread_attr_t attr;
    309         int ret;
    310         ret = pthread_attr_init( &attr );                                       // initialize attribute
    311         if ( ret ) {
    312                 abort( "%s : internal error, pthread_attr_init failed, error(%d) %s.", __PRETTY_FUNCTION__, ret, strerror( ret ) );
    313         } // if
    314 
    315         size_t stacksize;
    316         ret = pthread_attr_getstacksize( &attr, &stacksize ); // default stack size, normally defined by shell limit
    317         if ( ret ) {
    318                 abort( "%s : internal error, pthread_attr_getstacksize failed, error(%d) %s.", __PRETTY_FUNCTION__, ret, strerror( ret ) );
    319         } // if
    320         assert( stacksize >= PTHREAD_STACK_MIN );
    321 
    322         kernelTLS.preemption_state.stack = malloc( stacksize );
    323         ret = pthread_attr_setstack( &attr, kernelTLS.preemption_state.stack, stacksize );
    324         if ( ret ) {
    325                 abort( "%s : internal error, pthread_attr_setstack failed, error(%d) %s.", __PRETTY_FUNCTION__, ret, strerror( ret ) );
    326         } // if
    327 
    328         ret = pthread_create( &alarm_thread, &attr, alarm_loop, 0p );
    329         if ( ret ) {
    330                 abort( "%s : internal error, pthread_create failed, error(%d) %s.", __PRETTY_FUNCTION__, ret, strerror( ret ) );
    331         } // if
     308        kernelTLS.preemption_state.stack = create_pthread( &alarm_thread, alarm_loop, 0p );
    332309}
    333310
Note: See TracChangeset for help on using the changeset viewer.