tpi_tnycthrd.c
Go to the documentation of this file.
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
130 /* if we want to wait when the queue is full, then we broadcast that the queue can now take new jobs */
297 /* @todo we want to work out what to do with a full job queue. Is there a problem if the limit is hit? */
298 /* @note it is important to have a queuesize. This will stop the code submitting infinitely many jobs. */
315 SCIP_CALL_ABORT( SCIPtpiSignalCondition(&(threadpool->queuenotempty)) ); /* signalling to all threads that the queue has jobs
342 /* Wait until the job queue is not full. If the queue is closed or the thread pool is shutdown, then stop waiting */
343 /* @todo this needs to be checked. It is possible that a job can be submitted and then the queue is closed or the
345 while( _threadpool->jobqueue->njobs == _threadpool->queuesize && !(_threadpool->shutdown || !_threadpool->queueopen) )
350 /* if the thread pool is shutdown or the queue is closed, then we need to leave the job submission */
433 /* if the jobs in the queue should be completed, then we wait until the queueempty condition is set */
469 /* freeing the current jobs list. This assumes that all jobs complete before the tpi is closed. */
605 assert(job->jobid == _threadpool->currentid); /* the job id must be set before submitting the job. The submitter controls
626 while( isJobRunning(_threadpool->currentjobs, jobid) || isJobRunning(_threadpool->jobqueue, jobid) )
SCIP_RETCODE SCIPtpiWaitCondition(SCIP_CONDITION *condition, SCIP_LOCK *lock)
Definition: tpi_openmp.c:287
Definition: type_tpi.h:42
Definition: type_tpi.h:55
Definition: type_tpi.h:40
Definition: tpi_openmp.c:29
static SCIP_JOBSTATUS checkJobQueue(SCIP_JOBQUEUE *jobqueue, int jobid)
Definition: tpi_tnycthrd.c:494
SCIP_RETCODE SCIPtpiBroadcastCondition(SCIP_CONDITION *condition)
Definition: tpi_openmp.c:275
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:218
SCIP_RETCODE SCIPtpiCreateJob(SCIP_JOB **job, int jobid, SCIP_RETCODE(*jobfunc)(void *args), void *jobarg)
Definition: tpi_tnycthrd.c:565
SCIP_RETCODE SCIPtpiInit(int nthreads, int queuesize, SCIP_Bool blockwhenfull)
Definition: tpi_tnycthrd.c:541
Definition: type_tpi.h:56
SCIP_RETCODE SCIPtpiReleaseLock(SCIP_LOCK *lock)
the type definitions for the SCIP parallel interface
static SCIP_RETCODE threadPoolThreadRetcode(void *threadnum)
Definition: tpi_tnycthrd.c:82
Definition: type_retcode.h:33
Definition: type_retcode.h:34
SCIP_RETCODE SCIPtpiInitLock(SCIP_LOCK *lock)
Definition: tpi_tnycthrd.c:52
Definition: type_tpi.h:43
Definition: tpi_openmp.c:39
void SCIPtpiDestroyLock(SCIP_LOCK *lock)
void SCIPtpiDestroyCondition(SCIP_LOCK *lock)
static SCIP_RETCODE threadPoolAddWork(SCIP_JOB *newjob, SCIP_SUBMITSTATUS *status)
Definition: tpi_tnycthrd.c:324
SCIP_RETCODE SCIPtpiSignalCondition(SCIP_CONDITION *condition)
Definition: tpi_openmp.c:261
static SCIP_RETCODE freeThreadPool(SCIP_THREADPOOL **thrdpool, SCIP_Bool finishjobs, SCIP_Bool completequeue)
Definition: tpi_tnycthrd.c:408
SCIP_RETCODE SCIPtpiSumbitJob(SCIP_JOB *job, SCIP_SUBMITSTATUS *status)
Definition: tpi_tnycthrd.c:598
static SCIP_Bool isJobRunning(SCIP_JOBQUEUE *currentjobs, int jobid)
Definition: tpi_tnycthrd.c:521
static void jobQueueAddJob(SCIP_THREADPOOL *threadpool, SCIP_JOB *newjob)
Definition: tpi_tnycthrd.c:292
Definition: type_tpi.h:41
memory allocation routines