Tweak to callback API.
This commit is contained in:
@@ -20,6 +20,11 @@
|
||||
|
||||
-->
|
||||
|
||||
<h3>Callback subsystem API</h3>
|
||||
|
||||
<p>Added a new macro <tt>callbackGetPriority(prio, callback)</tt> to the
|
||||
callback.h header and removed the need for dbScan.c to reach into the internals
|
||||
of its CALLBACK objects.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -47,14 +47,16 @@ typedef struct callbackPvt {
|
||||
|
||||
typedef void (*CALLBACKFUNC)(struct callbackPvt*);
|
||||
|
||||
#define callbackSetCallback(PFUN,PCALLBACK)\
|
||||
( (PCALLBACK)->callback = (PFUN) )
|
||||
#define callbackSetPriority(PRIORITY,PCALLBACK)\
|
||||
( (PCALLBACK)->priority = (PRIORITY) )
|
||||
#define callbackSetUser(USER,PCALLBACK)\
|
||||
( (PCALLBACK)->user = (void *)(USER) )
|
||||
#define callbackGetUser(USER,PCALLBACK)\
|
||||
( (USER) = (void *)((CALLBACK *)(PCALLBACK))->user )
|
||||
#define callbackSetCallback(PFUN, PCALLBACK) \
|
||||
( (PCALLBACK)->callback = (PFUN) )
|
||||
#define callbackSetPriority(PRIORITY, PCALLBACK) \
|
||||
( (PCALLBACK)->priority = (PRIORITY) )
|
||||
#define callbackGetPriority(PRIORITY, PCALLBACK) \
|
||||
( (PRIORITY) = (PCALLBACK)->priority )
|
||||
#define callbackSetUser(USER, PCALLBACK) \
|
||||
( (PCALLBACK)->user = (void *) (USER) )
|
||||
#define callbackGetUser(USER, PCALLBACK) \
|
||||
( (USER) = (PCALLBACK)->user )
|
||||
|
||||
epicsShareFunc void callbackInit(void);
|
||||
epicsShareFunc void callbackShutdown(void);
|
||||
|
||||
@@ -813,9 +813,11 @@ static void spawnPeriodic(int ind)
|
||||
|
||||
static void ioscanCallback(CALLBACK *pcallback)
|
||||
{
|
||||
ioscan_head *piosh = (ioscan_head *) pcallback->user;
|
||||
int prio = pcallback->priority;
|
||||
ioscan_head *piosh;
|
||||
int prio;
|
||||
|
||||
callbackGetUser(piosh, pcallback);
|
||||
callbackGetPriority(prio, pcallback);
|
||||
scanList(&piosh->iosl[prio].scan_list);
|
||||
if (piosh->cb)
|
||||
piosh->cb(piosh->arg, piosh, prio);
|
||||
|
||||
Reference in New Issue
Block a user