Ignore:
Timestamp:
Nov 30, 2019, 1:17:32 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
1805b1b, e8c52cf
Parents:
e71c1d4 (diff), ce7bdc4 (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    re71c1d4 r4fa8f1a  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov 21 16:46:59 2019
    13 // Update Count     : 27
     12// Last Modified On : Fri Nov 29 17:59:16 2019
     13// Update Count     : 35
    1414//
    1515
     
    2626#include <signal.h>
    2727#include <unistd.h>
     28#include <limits.h>                                                                             // PTHREAD_STACK_MIN
    2829}
    2930
     
    133134        NULL,
    134135        NULL,
    135         { 1, false, false },
     136        { NULL, 1, false, false },
    136137        6u //this should be seeded better but due to a bug calling rdtsc doesn't work
    137138};
     
    233234
    234235        pthread_join( kernel_thread, NULL );
     236        free( this.stack );
    235237}
    236238
     
    445447        __cfaabi_dbg_print_safe("Kernel : Starting core %p\n", this);
    446448
    447         pthread_create( &this->kernel_thread, NULL, CtxInvokeProcessor, (void*)this );
     449        pthread_attr_t attr;
     450        int ret;
     451        ret = pthread_attr_init( &attr );                                       // initialize attribute
     452        if ( ret ) {
     453                abort( "%s : internal error, pthread_attr_init failed, error(%d) %s.", __PRETTY_FUNCTION__, ret, strerror( ret ) );
     454        } // if
     455
     456        size_t stacksize;
     457        ret = pthread_attr_getstacksize( &attr, &stacksize ); // default stack size, normally defined by shell limit
     458        if ( ret ) {
     459                abort( "%s : internal error, pthread_attr_getstacksize failed, error(%d) %s.", __PRETTY_FUNCTION__, ret, strerror( ret ) );
     460        } // if
     461        assert( stacksize >= PTHREAD_STACK_MIN );
     462
     463        this->stack = malloc( stacksize );
     464        ret = pthread_attr_setstack( &attr, this->stack, stacksize );
     465        if ( ret ) {
     466                abort( "%s : internal error, pthread_attr_setstack failed, error(%d) %s.", __PRETTY_FUNCTION__, ret, strerror( ret ) );
     467        } // if
     468
     469        ret = pthread_create( &this->kernel_thread, &attr, CtxInvokeProcessor, (void *)this );
     470        if ( ret ) {
     471                abort( "%s : internal error, pthread_create failed, error(%d) %s.", __PRETTY_FUNCTION__, ret, strerror( ret ) );
     472        } // if
     473//      pthread_create( &this->kernel_thread, NULL, CtxInvokeProcessor, (void*)this );
    448474
    449475        __cfaabi_dbg_print_safe("Kernel : core %p started\n", this);
Note: See TracChangeset for help on using the changeset viewer.