cleanup and inithook
This commit is contained in:
@ -152,6 +152,21 @@ fail:
|
||||
PyGILState_Release(gilstate);
|
||||
}
|
||||
|
||||
static
|
||||
PyObject* py_announce(PyObject *unused, PyObject *args, PyObject *kws)
|
||||
{
|
||||
static char* names[] = {"state", NULL};
|
||||
int state;
|
||||
if(!PyArg_ParseTupleAndKeywords(args, kws, "i", names, &state))
|
||||
return NULL;
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS {
|
||||
initHookAnnounce((initHookState)state);
|
||||
} Py_END_ALLOW_THREADS
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static
|
||||
PyObject *py_iocsh(PyObject *unused, PyObject *args, PyObject *kws)
|
||||
{
|
||||
@ -237,7 +252,6 @@ PyObject *py_iocInit(PyObject *unused, PyObject *args, PyObject *kws)
|
||||
static
|
||||
PyObject *py_pyDevSupCommon(PyObject *unused)
|
||||
{
|
||||
static int once;
|
||||
Py_BEGIN_ALLOW_THREADS {
|
||||
pyDevSupCommon_registerRecordDeviceDriver(pdbbase);
|
||||
} Py_END_ALLOW_THREADS
|
||||
@ -246,6 +260,8 @@ PyObject *py_pyDevSupCommon(PyObject *unused)
|
||||
}
|
||||
|
||||
static struct PyMethodDef dbapimethod[] = {
|
||||
{"initHookAnnounce", (PyCFunction)py_announce, METH_VARARGS|METH_KEYWORDS,
|
||||
"initHookAnnounce(state)\n"},
|
||||
{"iocsh", (PyCFunction)py_iocsh, METH_VARARGS|METH_KEYWORDS,
|
||||
"Execute IOC shell script or command"},
|
||||
{"dbReadDatabase", (PyCFunction)py_dbReadDatabase, METH_VARARGS|METH_KEYWORDS,
|
||||
|
@ -81,4 +81,6 @@ device(aao, INST_IO, pydevsupComOut, "Python Device")
|
||||
_dbapi._dbd_setup()
|
||||
|
||||
def _fini(iocMain=False):
|
||||
if iocMain:
|
||||
_dbapi.initHookAnnounce(9999) # our magic/fake AtExit hook
|
||||
_dbapi._dbd_cleanup()
|
||||
|
@ -328,7 +328,7 @@ class Record(_dbapi._Record):
|
||||
threading.Timer(1.0, record.asyncFinish, kwargs={'reason':AsyncDone})
|
||||
record.asyncStart()
|
||||
"""
|
||||
return _dbapi._Record.asyncStart(self, reason=reason)
|
||||
return _dbapi._Record.asyncFinish(self, reason=reason)
|
||||
|
||||
def __getattr__(self, name):
|
||||
try:
|
||||
|
@ -33,6 +33,7 @@ class IOCHelper(unittest.TestCase):
|
||||
def tearDown(self):
|
||||
self.iocShutdown();
|
||||
print("testdbCleanup()")
|
||||
_dbapi.initHookAnnounce(9999) # our magic/fake AtExit hook
|
||||
_dbapi._UTest.testdbCleanup()
|
||||
|
||||
def iocInit(self):
|
||||
|
Reference in New Issue
Block a user