Ignore:
Timestamp:
Dec 1, 2019, 11:40:54 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
1f6de372, 3901457, 3b0c8cb
Parents:
4fa8f1a
Message:

refactor pthread_create into create_pthread, change NULL to 0p

File:
1 edited

Legend:

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

    r4fa8f1a 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.