fixed priority polarization of event thread
This commit is contained in:
@@ -945,10 +945,9 @@ LOCAL void event_task (void *pParm)
|
||||
*/
|
||||
int epicsShareAPI db_start_events (
|
||||
dbEventCtx ctx,const char *taskname, void (*init_func)(threadId),
|
||||
void *init_func_arg, int priority_offset)
|
||||
void *init_func_arg, unsigned osiPriority )
|
||||
{
|
||||
struct event_user *evUser = (struct event_user *) ctx;
|
||||
int taskpri;
|
||||
|
||||
semMutexMustTake (evUser->firstque.writelock);
|
||||
|
||||
@@ -961,8 +960,6 @@ int epicsShareAPI db_start_events (
|
||||
return DB_EVENT_OK;
|
||||
}
|
||||
|
||||
taskpri = threadGetPrioritySelf ();
|
||||
taskpri -= priority_offset;
|
||||
evUser->pendexit = FALSE;
|
||||
evUser->init_func = init_func;
|
||||
evUser->init_func_arg = init_func_arg;
|
||||
@@ -970,7 +967,7 @@ int epicsShareAPI db_start_events (
|
||||
taskname = EVENT_PEND_NAME;
|
||||
}
|
||||
evUser->taskid = threadCreate (
|
||||
taskname, taskpri, threadGetStackSize(threadStackMedium),
|
||||
taskname, osiPriority, threadGetStackSize(threadStackMedium),
|
||||
event_task, (void *)evUser);
|
||||
if (!evUser->taskid) {
|
||||
semMutexGive (evUser->firstque.writelock);
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef void EXTRALABORFUNC (void *extralabor_arg);
|
||||
epicsShareFunc dbEventCtx epicsShareAPI db_init_events (void);
|
||||
epicsShareFunc int epicsShareAPI db_start_events (
|
||||
dbEventCtx ctx, const char *taskname, void (*init_func)(void *),
|
||||
void *init_func_arg, int priority_offset);
|
||||
void *init_func_arg, unsigned osiPriority );
|
||||
epicsShareFunc void epicsShareAPI db_close_events (dbEventCtx ctx);
|
||||
epicsShareFunc void epicsShareAPI db_event_flow_ctrl_mode_on (dbEventCtx ctx);
|
||||
epicsShareFunc void epicsShareAPI db_event_flow_ctrl_mode_off (dbEventCtx ctx);
|
||||
|
||||
@@ -115,7 +115,6 @@ extern "C" void cacAttachClientCtx ( void * pPrivate )
|
||||
|
||||
dbEventSubscription dbServiceIO::subscribe ( struct dbAddr &addr, dbSubscriptionIO &subscr, unsigned mask )
|
||||
{
|
||||
static const int slightlyHigherPriority = -1;
|
||||
caClientCtx clientCtx;
|
||||
dbEventSubscription es;
|
||||
int status;
|
||||
@@ -132,10 +131,18 @@ dbEventSubscription dbServiceIO::subscribe ( struct dbAddr &addr, dbSubscription
|
||||
this->mutex.unlock ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned selfPriority = threadGetPrioritySelf ();
|
||||
unsigned above;
|
||||
threadBoolStatus tbs = threadLowestPriorityLevelAbove
|
||||
(selfPriority, &above);
|
||||
if ( tbs != tbsSuccess ) {
|
||||
above = selfPriority;
|
||||
}
|
||||
status = db_start_events ( this->ctx, "CAC-event",
|
||||
cacAttachClientCtx, clientCtx, slightlyHigherPriority );
|
||||
cacAttachClientCtx, clientCtx, above );
|
||||
if ( status ) {
|
||||
db_close_events (this->ctx);
|
||||
db_close_events ( this->ctx );
|
||||
this->ctx = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user