1414# dispatcher(func, *args) will queue a callback to happen
1515dispatcher = None
1616
17+ # Global blocking flag, used to mark asynchronous (False) or synchronous (True)
18+ # processing modes for Out records.
19+ # Default False to maintain behaviour from previous versions.
20+ blocking = False
21+
22+ def set_blocking (val ):
23+ global blocking
24+ blocking = val
25+
1726
1827# EPICS processing return codes
1928EPICS_OK = 0
@@ -142,6 +151,8 @@ def __init__(self, name, **kargs):
142151 else :
143152 self ._value = None
144153
154+ self ._blocking = kargs .pop ('blocking' , blocking )
155+
145156 self .__super .__init__ (name , ** kargs )
146157
147158 def init_record (self , record ):
@@ -162,6 +173,13 @@ def init_record(self, record):
162173 recGblResetAlarms (record )
163174 return self ._epics_rc_
164175
176+ def __completion (self ):
177+ pass
178+
179+ def __wrap_completion (self , value ):
180+ self .__on_update (value )
181+ self .__completion ()
182+
165183 def _process (self , record ):
166184 '''Processing suitable for output records. Performs immediate value
167185 validation and asynchronous update notification.'''
@@ -183,7 +201,7 @@ def _process(self, record):
183201 self ._value = value
184202 record .UDF = 0
185203 if self .__on_update and self .__enable_write :
186- dispatcher (self .__on_update , python_value )
204+ dispatcher (self .__wrap_completion , python_value )
187205 return EPICS_OK
188206
189207
0 commit comments