tpi_tnycthrd.c
Go to the documentation of this file.
32 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
139 /* if we want to wait when the queue is full, then we broadcast that the queue can now take new jobs */
308 /* @todo we want to work out what to do with a full job queue. Is there a problem if the limit is hit? */
309 /* @note it is important to have a queuesize. This will stop the code submitting infinitely many jobs. */
326 /* signalling to all threads that the queue has jobs using the signal instead of broadcast because only one thread
353 /* Wait until the job queue is not full. If the queue is closed or the thread pool is shut down, then stop waiting. */
354 /* @todo this needs to be checked. It is possible that a job can be submitted and then the queue is closed or the
356 while( _threadpool->jobqueue->njobs == _threadpool->queuesize && !(_threadpool->shutdown || !_threadpool->queueopen) )
361 /* if the thread pool is shut down or the queue is closed, then we need to leave the job submission */
442 /* if the jobs in the queue should be completed, then we wait until the queueempty condition is set */
478 /* Freeing the current jobs list. This assumes that all jobs complete before the tpi is closed. */
614 /* the job id must be set before submitting the job. The submitter controls whether a new id is required. */
634 while( isJobRunning(_threadpool->currentjobs, jobid) || isJobRunning(_threadpool->jobqueue, jobid) )
SCIP_RETCODE SCIPtpiWaitCondition(SCIP_CONDITION *condition, SCIP_LOCK *lock)
Definition: tpi_openmp.c:304
Definition: type_tpi.h:51
Definition: type_tpi.h:64
Definition: type_tpi.h:49
Definition: tpi_openmp.c:38
static SCIP_JOBSTATUS checkJobQueue(SCIP_JOBQUEUE *jobqueue, int jobid)
Definition: tpi_tnycthrd.c:503
SCIP_RETCODE SCIPtpiBroadcastCondition(SCIP_CONDITION *condition)
Definition: tpi_openmp.c:289
SCIP_RETCODE SCIPtpiAcquireLock(SCIP_LOCK *lock)
SCIP_RETCODE SCIPtpiInitCondition(SCIP_LOCK *lock)
static SCIP_RETCODE createThreadPool(SCIP_THREADPOOL **thrdpool, int nthreads, int qsize, SCIP_Bool blockwhenfull)
Definition: tpi_tnycthrd.c:227
SCIP_RETCODE SCIPtpiCreateJob(SCIP_JOB **job, int jobid, SCIP_RETCODE(*jobfunc)(void *args), void *jobarg)
Definition: tpi_tnycthrd.c:574
SCIP_RETCODE SCIPtpiInit(int nthreads, int queuesize, SCIP_Bool blockwhenfull)
Definition: tpi_tnycthrd.c:550
Definition: type_tpi.h:65
SCIP_RETCODE SCIPtpiReleaseLock(SCIP_LOCK *lock)
the type definitions for the SCIP parallel interface
static SCIP_RETCODE threadPoolThreadRetcode(void *threadnum)
Definition: tpi_tnycthrd.c:91
Definition: type_retcode.h:42
Definition: type_retcode.h:43
SCIP_RETCODE SCIPtpiInitLock(SCIP_LOCK *lock)
Definition: tpi_tnycthrd.c:61
Definition: type_tpi.h:52
Definition: tpi_openmp.c:48
void SCIPtpiDestroyLock(SCIP_LOCK *lock)
void SCIPtpiDestroyCondition(SCIP_LOCK *lock)
static SCIP_RETCODE threadPoolAddWork(SCIP_JOB *newjob, SCIP_SUBMITSTATUS *status)
Definition: tpi_tnycthrd.c:335
SCIP_RETCODE SCIPtpiSignalCondition(SCIP_CONDITION *condition)
Definition: tpi_openmp.c:271
static SCIP_RETCODE freeThreadPool(SCIP_THREADPOOL **thrdpool, SCIP_Bool finishjobs, SCIP_Bool completequeue)
Definition: tpi_tnycthrd.c:417
SCIP_RETCODE SCIPtpiSumbitJob(SCIP_JOB *job, SCIP_SUBMITSTATUS *status)
Definition: tpi_tnycthrd.c:607
static SCIP_Bool isJobRunning(SCIP_JOBQUEUE *currentjobs, int jobid)
Definition: tpi_tnycthrd.c:530
static void jobQueueAddJob(SCIP_THREADPOOL *threadpool, SCIP_JOB *newjob)
Definition: tpi_tnycthrd.c:303
Definition: type_tpi.h:50
memory allocation routines