mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
Propagate errors from set_threads instead of ignoring them
set_threads silently ignored failures from _add_thread_locked (e.g. pthread_create failure) and _remove_thread_locked (e.g. at min_threads). The caller had no way to know the pool was undersized or that shrinking stopped early. Stop on the first error and return it so callers can detect partial completion. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
82e7980ec9
commit
055a2d4abe
1 changed files with 13 additions and 2 deletions
|
|
@ -745,10 +745,21 @@ ThreadPool::set_threads(const std::size_t count_)
|
|||
current = _threads.size();
|
||||
}
|
||||
|
||||
int rv = 0;
|
||||
|
||||
for(std::size_t i = current; i < count_; ++i)
|
||||
_add_thread_locked({});
|
||||
{
|
||||
rv = _add_thread_locked({});
|
||||
if(rv != 0)
|
||||
return rv;
|
||||
}
|
||||
|
||||
for(std::size_t i = count_; i < current; ++i)
|
||||
_remove_thread_locked();
|
||||
{
|
||||
rv = _remove_thread_locked();
|
||||
if(rv != 0)
|
||||
return rv;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue