inline static void mark_threads(NewGC *gc, int owner) { GC_Thread_Info *work; Mark2_Proc thread_mark = gc->mark_table[btc_redirect_thread]; for(work = gc->thread_infos; work; work = work->next) { if (work->owner == owner) { if (((Scheme_Object *)work->thread)->type == scheme_thread_type) { /* thread */ if (((Scheme_Thread *)work->thread)->running) { thread_mark(work->thread, gc); if (work->thread == scheme_current_thread) { GC_mark_variable_stack(GC_variable_stack, 0, get_stack_base(gc), NULL); } } } else { /* place */ #ifdef MZ_USE_PLACES /* add in the memory used by the place's GC */ intptr_t sz; Scheme_Place_Object *place_obj = ((Scheme_Place *)work->thread)->place_obj; if (place_obj) { mzrt_mutex_lock(place_obj->lock); sz = place_obj->memory_use; mzrt_mutex_unlock(place_obj->lock); account_memory(gc, owner, gcBYTES_TO_WORDS(sz), 0); } #endif } } } }
static void threadRoutine ( void * para ) { PARAMETER * prm; int i; unsigned char id; prm = ( PARAMETER * ) para; id = prm->threadID; //printf("%dth thread with threadID %d, hash_table %p\n",id,prm.threadID,prm.hash_table); while ( 1 ) { if ( * ( prm->selfSignal ) == 1 ) { for ( i = 0; i < kmer_c; i++ ) { //if((unsigned char)(magic_seq(hashBanBuffer[i])%thrd_num)!=id) //if((kmerBuffer[i]%thrd_num)!=id) if ( ( hashBanBuffer[i] % thrd_num ) != id ) { continue; } kmerCounter[id + 1]++; singleKmer ( i, KmerSets[id] ); } * ( prm->selfSignal ) = 0; } else if ( * ( prm->selfSignal ) == 2 ) { for ( i = 0; i < read_c; i++ ) { if ( i % thrd_num != id ) { continue; } chopKmer4read ( i, id + 1 ); } * ( prm->selfSignal ) = 0; } else if ( * ( prm->selfSignal ) == 3 ) { * ( prm->selfSignal ) = 0; break; } else if ( * ( prm->selfSignal ) == 4 ) { thread_mark ( KmerSets[id], id ); * ( prm->selfSignal ) = 0; } else if ( * ( prm->selfSignal ) == 5 ) { thread_delow ( KmerSets[id], id ); * ( prm->selfSignal ) = 0; } usleep ( 1 ); } }
inline static void mark_threads(NewGC *gc, int owner) { GC_Thread_Info *work; Mark2_Proc thread_mark = gc->mark_table[btc_redirect_thread]; for(work = gc->thread_infos; work; work = work->next) if(work->owner == owner) { if (((Scheme_Thread *)work->thread)->running) { thread_mark(work->thread, gc); if (work->thread == scheme_current_thread) { GC_mark_variable_stack(GC_variable_stack, 0, get_stack_base(gc), NULL); } } } }