string compressed;
{
- unique_lock<mutex> lock(mu);
+ unique_lock lock(mu);
queue_added.wait(lock, [&work_queue, &done] { return !work_queue.empty() || done; });
if (done && work_queue.empty()) {
return;
complete_pread(fd, &compressed[0], io_len, offsets[io_docid]);
{
- unique_lock<mutex> lock(mu);
+ unique_lock lock(mu);
queue_removed.wait(lock, [&work_queue] { return work_queue.size() < 256; }); // Allow ~2MB of data queued up.
work_queue.emplace_back(io_docid, last_docid, move(compressed));
queue_added.notify_one(); // Avoid the thundering herd.
if (only_count) {
printf("0\n");
}
- exit(0);
+ exit(1);
}
}
}
static const struct option long_options[] = {
{ "help", no_argument, 0, 'h' },
{ "count", no_argument, 0, 'c' },
+ { "all", no_argument, 0, 'A' },
{ "basename", no_argument, 0, 'b' },
{ "database", required_argument, 0, 'd' },
{ "existing", no_argument, 0, 'e' },
setlocale(LC_ALL, "");
for (;;) {
int option_index = 0;
- int c = getopt_long(argc, argv, "bcd:ehil:n:N0rwVD", long_options, &option_index);
+ int c = getopt_long(argc, argv, "Abcd:ehil:n:N0rwVD", long_options, &option_index);
if (c == -1) {
break;
}
switch (c) {
+ case 'A':
+ // Ignored.
+ break;
case 'b':
match_basename = true;
break;
}
if (needles.empty()) {
fprintf(stderr, "plocate: no pattern to search for specified\n");
- exit(0);
+ exit(1);
}
if (dbpaths.empty()) {
if (only_count) {
printf("%" PRId64 "\n", matched);
}
+
+ return matched == 0;
}