Show
Ignore:
Timestamp:
07/16/07 03:30:29 (17 months ago)
Author:
krobillard
Message:

Atoms should now be thread safe. First thread experiment runs.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/thune/thread_safe/urlan.c

    r427 r431  
    411411    int i; 
    412412 
     413    //printf( "KR sizeof(pthread_t) = %lu\n", sizeof(pthread_t) ); 
     414    //assert( sizeof(UCellThread) == 16 ); 
     415 
    413416    assert( sizeof(UCell) == 16 ); 
    414417    //assert( sizeof(LocalFrame) == 16 ); 
     
    451454  \param customCount  Number of UDatatype in custom array. 
    452455 
    453   \returns UR_EVAL_ code. 
     456  \return  UR_EVAL_ code. 
    454457*/ 
    455458int ur_startup( UrlanEnv* env, UDatatype* custom, int customCount ) 
     
    467470    env->dtCount  = UT_BI_COUNT + customCount; 
    468471 
    469     ur_arrayInit( &env->atoms,     sizeof(AtomRec),      4096 ); 
    470     ur_arrayInit( &env->atomNames, sizeof(char),         2048 ); 
     472    ur_arrayInit( &env->atoms,     sizeof(AtomRec),      2048 ); 
     473    ur_arrayInit( &env->atomNames, sizeof(char),         2048 * 6 ); 
    471474    ur_arrayInit( &env->devices,   sizeof(UPortDevice*),    8 ); 
    472475    ur_rebuildAtomHash( &env->atoms ); 
     
    485488    // Init main thread. 
    486489 
    487     if( mutexInit( env->mutex ) == -1 ) 
    488     { 
    489 #ifndef _WIN32 
     490    if( mutexInitF( env->mutex ) ) 
     491    { 
     492#ifdef _WIN32 
     493        //GetLastError(); 
     494#else 
    490495        perror( "mutexInit" ); 
    491496#endif 
     
    495500    ut = ur_threadMake( env, 512, 1024 ); 
    496501 
    497     // Make hold & global context blocks. 
    498     ur_makeBlock( 8 );        // 0 - BLK_THREAD_HOLD 
    499     ur_makeBlock( 1024 );     // 1 - BLK_GLOBAL_WORD 
    500     ur_makeBlock( 1024 );     // 2 - BLK_GLOBAL_VAL 
    501     ur_makeBlock( 1 );        // 3 - BLK_CTX_STACK 
    502     //ur_makeBlock( 0 );        // 4 - BLK_DSTACK 
    503  
    504     ur_pushContext( ut, (UCell*) &ur_thrGlobal ); 
    505  
    506     { 
    507     //UBlock* blk = ur_tblockPtr( BLK_DSTACK ); 
    508     } 
    509502 
    510503    // Add datatypes first so UT_ defines match the index & atom.