How to implement blocking without interactive_ioc() #92
-
Apologies for my NOOB question - I'm not familiar with cothreads or asyncio. Basically I want to run my IOC in the background (via ssh with nohup), which cannot be done with a python shell running. I understand the logic is to use run_forever() or WaitForQuit(), but not sure of how to do it exactly. I would like to create a PV (call it "QUIT" because why not) that can be used to quit the program - how do I implement this. I initially created my ioc on Windows, so was using asyncio, but am porting to Linux - I'd be grateful for examples of both asyncio and cothread implementations. Obviously I can also kill the process to quite the IOC. Thnx |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
We have some simple example programs of both cothread and asyncio, available in the docs/examples directory. Those should show the basic syntax differences between the two. I'm not sure how To quit the IOC, the answer changes based on whether you use |
Beta Was this translation helpful? Give feedback.
We have some simple example programs of both cothread and asyncio, available in the docs/examples directory. Those should show the basic syntax differences between the two. I'm not sure how
softioc.interactive_ioc()
interacts withnohup
, so you may need to do as you say and use alternative functions.To quit the IOC, the answer changes based on whether you use
asyncio
orcothread
. In both cases you'll want to create your "QUIT" PV, and set anon_update
function (and perhapsalways_update=True
). Forcothread
I think its as simple as calling theQuit()
function. Forasyncio
I think you'll need to set up anEvent
and wait for it to be set from the main thread, and signal it from the update f…