job/queue: add default constructor
This commit is contained in:
parent
429c0151db
commit
d941188dd5
@ -16,12 +16,43 @@
|
||||
|
||||
#include "queue.hpp"
|
||||
|
||||
#include "../parse.hpp"
|
||||
#include "../raii.hpp"
|
||||
|
||||
using util::job::queue;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static unsigned
|
||||
default_parallelism (void)
|
||||
{
|
||||
if (auto var = getenv ("JOB_THREADS")) {
|
||||
return util::parse<unsigned> (var);
|
||||
}
|
||||
|
||||
return std::thread::hardware_concurrency ();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static unsigned
|
||||
default_depth (void)
|
||||
{
|
||||
if (auto var = getenv ("JOB_DEPTH")) {
|
||||
return util::parse<unsigned> (var);
|
||||
}
|
||||
|
||||
return 1024;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
queue::queue ():
|
||||
queue (default_parallelism (), default_depth ())
|
||||
{ ; }
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
queue::queue (unsigned thread_count, unsigned pool_size):
|
||||
m_tasks {
|
||||
{}, util::pool<task> {pool_size}, {}, {}
|
||||
|
@ -41,10 +41,7 @@
|
||||
namespace util::job {
|
||||
class queue {
|
||||
public:
|
||||
queue ():
|
||||
queue (std::thread::hardware_concurrency (), 1024)
|
||||
{ ; }
|
||||
|
||||
queue ();
|
||||
queue (unsigned thread_count, unsigned pool_size);
|
||||
~queue ();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user