MCPcopy Create free account
hub / github.com/Genivia/ugrep / execute

Method execute

src/ugrep.cpp:4421–4452  ·  view source on GitHub ↗

execute worker thread

Source from the content-addressed store, hash-verified

4419
4420// execute worker thread
4421void GrepWorker::execute()
4422{
4423 if (Static::cores >= 3)
4424 set_this_thread_affinity_and_priority(id);
4425
4426 Job job;
4427
4428 while (!out.eof && !out.cancelled())
4429 {
4430 // wait for next job
4431 next_job(job);
4432
4433 // worker should stop?
4434 if (job.none())
4435 break;
4436
4437 // start synchronizing output for this job slot in ORDERED mode (--sort)
4438 out.begin(job.slot);
4439
4440 // search the file for this job, an empty pathname means stdin
4441 search(job.pathname.empty() ? Static::LABEL_STANDARD_INPUT : job.pathname.c_str(), job.cost);
4442
4443 // end output in ORDERED mode (--sort) for this job slot
4444 out.end();
4445
4446#ifndef WITH_LOCK_FREE_JOB_QUEUE
4447 // if only one job is left to do or nothing to do, then try stealing another job from a co-worker
4448 if (jobs.todo <= 1)
4449 master->steal(this);
4450#endif
4451 }
4452}
4453
4454// the CNF of Boolean search queries and patterns
4455CNF Static::bcnf;

Callers

nothing calls this directly

Calls 7

noneMethod · 0.80
stealMethod · 0.80
cancelledMethod · 0.45
beginMethod · 0.45
emptyMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected