diff PR.c @ 289:744b5ff9851e

Merge
author Sean Halle <seanhalle@yahoo.com>
date Thu, 05 Sep 2013 18:08:14 -0700
parents 15ee3fe10e3d b02b34681414
children
line diff
     1.1 --- a/PR.c	Thu Sep 05 18:05:11 2013 -0700
     1.2 +++ b/PR.c	Thu Sep 05 18:08:14 2013 -0700
     1.3 @@ -65,7 +65,7 @@
     1.4     PR_SS__create_topEnv();
     1.5     
     1.6    #ifdef DEBUG__TURN_ON_SEQUENTIAL_MODE
     1.7 -   printf( "\n\n Running in SEQUENTIAL mode \n\n" );
     1.8 +   printf( "\n\n Running in SEQUENTIAL mode -- NUM_CORES: %d \n\n", NUM_CORES );
     1.9        //Only difference between version with an OS thread pinned to each core and
    1.10        // the sequential version of PR is PR__init_Seq, this, and coreCtlr_Seq.
    1.11  
    1.12 @@ -100,7 +100,7 @@
    1.13   * 
    1.14   */
    1.15  PRProcess *
    1.16 -PR__create_process( TopLevelFnPtr seed_Fn, void *seedData )
    1.17 +PR__create_process( BirthFnPtr seed_Fn, void *seedData )
    1.18   { SlaveVP    *seedSlv;
    1.19     PRProcess  *process;
    1.20     PRLangEnv **langEnvs, **langEnvsList;
    1.21 @@ -232,9 +232,11 @@
    1.22        process->executionIsComplete = TRUE;
    1.23      }
    1.24    #else
    1.25 -      //First get the "ACK" lock, then do normal wait for signal, then release
    1.26 -      // ACK lock, to let end-process know it can free the process struct
    1.27 -   pthread_mutex_lock( &(process->doneAckLock) );   
    1.28 +      //This is called from main thread, so must use OS thread constructs to
    1.29 +      // force the main thread to block (suspend) until it is signalled that
    1.30 +      // the process is complete.  One issue is that the mutex and cond variable
    1.31 +      // are inside the process data struct, which is freed when the process
    1.32 +      // ends!
    1.33     pthread_mutex_lock( &(process->doneLock) );
    1.34     while( process->executionIsComplete != TRUE )
    1.35      {