I'd want to create an event-loop program in the style of a Python script. What I'm looking for is:
- When the timer goes off, I'll be able to get a callback when the timer goes off.
- It will set a timer in the callback. The cycle will not be broken. In the meanwhile, I'm hoping that an RPC server can process RPC requests inside the same loop.
Using two threads, I believe, would make this possible. However, I'm not sure whether we're limited to utilizing a single thread for this. Select and epoll come to mind. However, I'm not interested in starting from scratch using RPC via a socket. RPC libraries that already exist will do the trick for me.
I tried apscheduler's BlockingScheduler, but it didn't work for me. My first criterion is satisfied. As a case study:
block scheduling scheduler () scheduler.add job(...) scheduler.start() Using RPC libraries, we may register methods and associated callbacks, and then use the object's run/start function to keep it going.
Are timers and RPCs feasible to combine into one loop? Is there a standard way of doing this? Because I believe multi-threading is more complicated and prone to errors, I avoided it wherever possible. There must be a simpler method. As long as the answer is straightforward, I am open to any idea that is good enough. Here is my website url: https://www.lastpriceng.com/