thread pool: mark epicsJobCreate() as safe for job functions
Also, use epicsJobMove() to avoid some redundant code
This commit is contained in:
@@ -100,6 +100,7 @@ epicsShareExtern void* _epicsJobArgSelf;
|
||||
/* creates, but does not add, a new job.
|
||||
* If pool in NULL then the job is not associated with any pool and
|
||||
* epicsJobMove() must be called before epicsJobQueue()
|
||||
* Safe to call from a running job function.
|
||||
* returns a new job pointer, or NULL on error
|
||||
*/
|
||||
epicsShareFunc epicsJob* epicsJobCreate(epicsThreadPool* pool,
|
||||
|
||||
@@ -152,17 +152,11 @@ epicsJob* epicsJobCreate(epicsThreadPool* pool,
|
||||
if(arg==&_epicsJobArgSelf)
|
||||
arg=job;
|
||||
|
||||
job->pool=pool;
|
||||
job->pool=NULL;
|
||||
job->func=func;
|
||||
job->arg=arg;
|
||||
|
||||
if(pool) {
|
||||
epicsMutexMustLock(pool->guard);
|
||||
|
||||
ellAdd(&pool->owned, &job->jobnode);
|
||||
|
||||
epicsMutexUnlock(pool->guard);
|
||||
}
|
||||
epicsJobMove(job, pool);
|
||||
|
||||
return job;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user