Added a hack to allow you to limit the number of threads per work queue (all other limits still apply). If you set this to 0 then chdman doesn't hang. [smf]

This commit is contained in:
smf- 2013-11-02 12:34:02 +00:00
parent 3a8af1934e
commit db806d8476

View File

@ -222,6 +222,7 @@ osd_work_queue *osd_work_queue_alloc(int flags)
int numprocs = effective_num_processors();
osd_work_queue *queue;
int threadnum;
TCHAR *osdworkqueuemaxthreads = _tgetenv(_T("OSDWORKQUEUEMAXTHREADS"));
// allocate a new queue
queue = (osd_work_queue *)malloc(sizeof(*queue));
@ -250,6 +251,9 @@ osd_work_queue *osd_work_queue_alloc(int flags)
else
queue->threads = (flags & WORK_QUEUE_FLAG_MULTI) ? numprocs : 1;
if (osdworkqueuemaxthreads != NULL && _stscanf(osdworkqueuemaxthreads, _T("%d"), &threadnum) == 1 && queue->threads > threadnum)
queue->threads = threadnum;
// multi-queues with high frequency items should top out at 4 for now
// since we have scaling problems above that
if ((flags & WORK_QUEUE_FLAG_HIGH_FREQ) && queue->threads > 1)