Getting started, wakeupAfter

23 views
Skip to first unread message

Daryl Stultz

unread,
Nov 11, 2021, 8:51:57 PM11/11/21
to thespian.py
Hello,

I have experience with Akka in production and Pykka in hobby work and I'm now taking a look at Thespian.

I'm trying to write an Actor that emits a "pulse" every three seconds and I'm trying to use wakeupAfter to do it. It does not appear to do anything, or of course I'm using it wrong. Also, it seems like there should be a "run forever" concept in the main line? I can't find anything so I'm using Event.wait() to keep it from exiting right away.

What would you expect as output from the attached program?
I get this:

got Start message
waiting for 3 seconds

Again, I don't see a WakeupMessage anywhere.

Thanks for the help!

/Daryl
pulse.py

kqu...@galois.com

unread,
Jan 9, 2022, 6:32:05 PM1/9/22
to thespian.py
Hello Daryl,

In your sample, you are simply calling `ActorSystem()` to initialize, which creates a `simpleSystemBase` by default (see https://thespianpy.com/doc/using.html#hH-f71b7bfa-c57b-4716-a2c7-ad83a2ed3582 and https://thespianpy.com/doc/using.html#hH-924dc0fe-c15b-491e-a6d1-8b88683d4c0d).  A simpleSystemBase is not threaded and runs single-threaaded in the context of the current process, which is probably not what you want (and also why you need the final statement in your `main`).  I'd recommend using a multi-process system base such as the `multiprocTCPBase` (https://thespianpy.com/doc/using.html#hH-9d33a877-b4f0-4012-9510-442d81b0837c).

Regards,
  Kevin
Reply all
Reply to author
Forward
0 new messages