EPICS Base
7.0.8.0
Loading...
Searching...
No Matches
callback.h
1
/*************************************************************************\
2
* Copyright (c) 2007 UChicago Argonne LLC, as Operator of Argonne
3
* National Laboratory.
4
* Copyright (c) 2002 The Regents of the University of California, as
5
* Operator of Los Alamos National Laboratory.
6
* Copyright (c) 2013 ITER Organization.
7
* SPDX-License-Identifier: EPICS
8
* EPICS BASE is distributed subject to a Software License Agreement found
9
* in file LICENSE that is included with this distribution.
10
\*************************************************************************/
11
12
/* includes for general purpose callback tasks */
13
/*
14
* Original Author: Marty Kraimer
15
* Date: 07-18-91
16
*/
17
18
#ifndef INCcallbackh
19
#define INCcallbackh 1
20
21
#include "dbCoreAPI.h"
22
23
#ifdef __cplusplus
24
extern
"C"
{
25
#endif
26
27
/*
28
* WINDOWS also has a "CALLBACK" type def
29
*/
30
#if defined(_WIN32) && !defined(EPICS_NO_CALLBACK)
31
# ifdef CALLBACK
32
# undef CALLBACK
33
# endif
/*CALLBACK*/
34
#endif
/*_WIN32*/
35
␌
36
#define NUM_CALLBACK_PRIORITIES 3
37
#define priorityLow 0
38
#define priorityMedium 1
39
#define priorityHigh 2
40
41
typedef
struct
callbackPvt {
42
void (*callback)(
struct
callbackPvt*);
43
int
priority;
44
void
*user;
/*for use by callback user*/
45
void
*timer;
/*for use by callback itself*/
46
}
epicsCallback
;
47
48
#if !defined(EPICS_NO_CALLBACK)
49
typedef
epicsCallback
CALLBACK
;
50
#endif
51
52
typedef
void (*CALLBACKFUNC)(
struct
callbackPvt*);
53
54
typedef
struct
callbackQueueStats
{
55
int
size;
56
int
numUsed[NUM_CALLBACK_PRIORITIES];
57
int
maxUsed[NUM_CALLBACK_PRIORITIES];
58
int
numOverflow[NUM_CALLBACK_PRIORITIES];
59
}
callbackQueueStats
;
60
61
#define callbackSetCallback(PFUN, PCALLBACK) \
62
( (PCALLBACK)->callback = (PFUN) )
63
#define callbackSetPriority(PRIORITY, PCALLBACK) \
64
( (PCALLBACK)->priority = (PRIORITY) )
65
#define callbackGetPriority(PRIORITY, PCALLBACK) \
66
( (PRIORITY) = (PCALLBACK)->priority )
67
#define callbackSetUser(USER, PCALLBACK) \
68
( (PCALLBACK)->user = (void *) (USER) )
69
#define callbackGetUser(USER, PCALLBACK) \
70
( (USER) = (PCALLBACK)->user )
71
72
DBCORE_API
void
callbackInit(
void
);
73
DBCORE_API
void
callbackStop(
void
);
74
DBCORE_API
void
callbackCleanup(
void
);
75
DBCORE_API
int
callbackRequest(
epicsCallback
*pCallback);
76
DBCORE_API
void
callbackSetProcess(
77
epicsCallback
*pcallback,
int
Priority,
void
*pRec);
78
DBCORE_API
int
callbackRequestProcessCallback(
79
epicsCallback
*pCallback,
int
Priority,
void
*pRec);
80
DBCORE_API
void
callbackRequestDelayed(
81
epicsCallback
*pCallback,
double
seconds);
82
DBCORE_API
void
callbackCancelDelayed(
epicsCallback
*pcallback);
83
DBCORE_API
void
callbackRequestProcessCallbackDelayed(
84
epicsCallback
*pCallback,
int
Priority,
void
*pRec,
double
seconds);
85
DBCORE_API
int
callbackSetQueueSize(
int
size);
86
DBCORE_API
int
callbackQueueStatus(
const
int
reset,
callbackQueueStats
*result);
87
DBCORE_API
void
callbackQueueShow(
const
int
reset);
88
DBCORE_API
int
callbackParallelThreads(
int
count,
const
char
*prio);
89
90
#ifdef __cplusplus
91
}
92
#endif
93
94
#endif
/*INCcallbackh*/
callbackQueueStats
Definition
callback.h:54
epicsCallback
Definition
callback.h:41
Generated on Fri Dec 15 2023 12:32:10 for EPICS Base by
1.9.8