Don't enforce creating at least one worker thread in TaskDispatch.

Everything can be confined to a single thread that does job dispatch,
and then waits for the jobs to finish. TaskDispatch has always executed
outstanding work during this wait, so no workers are needed.
This commit is contained in:
Bartosz Taudul 2023-05-01 15:44:27 +02:00
parent 58a6f703af
commit d6c5d3f6db
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 2 additions and 4 deletions

View File

@ -11,8 +11,6 @@ TaskDispatch::TaskDispatch( size_t workers, const char* name )
: m_exit( false )
, m_jobs( 0 )
{
assert( workers >= 1 );
m_workers.reserve( workers );
for( size_t i=0; i<workers; i++ )
{

View File

@ -18,9 +18,9 @@ TimelineController::TimelineController( View& view, Worker& worker, bool threadi
, m_view( view )
, m_worker( worker )
#ifdef __EMSCRIPTEN__
, m_td( 1 )
, m_td( 0 )
#else
, m_td( threading ? std::max( 1u, std::thread::hardware_concurrency() - 2 ) : 1, "Render" )
, m_td( threading ? (size_t)std::max( 0, (int)std::thread::hardware_concurrency() - 2 ) : 0, "Render" )
#endif
{
}