static void threadRoutine(void *para) { PARAMETER *prm; unsigned 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) { unsigned int seq_index = 0; unsigned int pos = 0; for(i = 0; i < kmer_c; i++) { if(seq_index < read_c && indexArray[seq_index + 1] == i) { seq_index++; // which sequence this kmer belongs to pos = 0; } //if((unsigned char)(hashBanBuffer[i]&taskMask)!=id){ if((unsigned char)(hashBanBuffer[i] % thrd_num) != id) { pos++; continue; } kmerCounter[id + 1]++; singleKmer(i, KmerSets[id], seq_index, pos++); } *(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; } usleep(1); } }
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 ); } }