Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while(retst) {
- if (qpipe.size() == 0) continue;
- pthread_mutex_lock(&self->mr);
- unsigned long n = qpipe.front();
- qpipe.pop();
- pthread_mutex_unlock(&self->mr);
- self->counter++;
- if (prime(n)) self->primes++;
- if (self->counter%1001 == 0) {
- printf("total numbers:%10lu; primes:%11lu; %% of primes:%7.4f\r", self->counter, self->primes, double(self->primes)/self->counter);
- ········ fflush(stdout);
- }
- }
- pthread_testcancel();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement