thread pool: mark epicsJobCreate() as safe for job functions

Also, use epicsJobMove() to avoid some redundant code
This commit is contained in:
Michael Davidsaver
2014-07-25 10:16:20 -04:00
parent cbfbce54f9
commit 95b916ecd4
2 changed files with 3 additions and 8 deletions

View File

@@ -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,

View File

@@ -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;
}