job/queue: expose default_parallelism query

This commit is contained in:
Danny Robson 2019-03-08 09:41:44 +11:00
parent 976d44b1d9
commit e0f4fdc308
2 changed files with 4 additions and 2 deletions

View File

@ -15,8 +15,8 @@ using cruft::job::queue;
///////////////////////////////////////////////////////////////////////////////
static unsigned
default_parallelism (void)
unsigned
queue::default_parallelism (void) noexcept
{
if (auto var = getenv ("JOB_THREADS")) {
return cruft::from_string<unsigned> (var);

View File

@ -42,6 +42,8 @@ namespace cruft::job {
queue& operator= (const queue&) = delete;
queue& operator= (queue&&) = delete;
static unsigned default_parallelism (void) noexcept;
auto parallelism (void) const { return m_threads.size (); }
auto capacity (void) const { return m_tasks.store.capacity (); }