Add comment to try and remove sched_yield().

A cond var might work here, but we need to make sure we aren't keeping
other threads from running file operations for no reason.
This commit is contained in:
Érico Nogueira 2021-09-18 15:57:57 -03:00
parent ff3cbb8471
commit f1b569a5de
1 changed files with 3 additions and 1 deletions

View File

@ -142,7 +142,9 @@ remove_dir:
int n;
while ((n = scandir(t.path, &entries, filter_dir, alphasort)) == -1) {
if (errno == ENFILE) {
/* sleep waiting for a closedir elsewhere */
/* sleep waiting for a closedir elsewhere
* TODO: try to broadcast when file operations are done so we don't waste CPU
* XXX: bad logic - tool now exits in an arbitrary point when the fd limit is lowered */
sched_yield();
continue;
} else {