feat: BREAKING force all zig actors to declare a destructor

Actors may be destroyed without ever calling their receivers. This is
regular behavior when an actor is killed by an exit message. C++ actors
cleanup automatically via their destructors. Up to now zig actor had to
enable trapping and cleanup on the exit message. This was a big foot gun
and cumbersome.

Now all zig actors are required to pass a deinit function to
thespian.receive. This simplifies clean up and prevents the foot gun
entirely.
This commit is contained in:
CJ van den Berg 2026-03-04 19:32:11 +01:00
parent b16a47efae
commit 5a729b6d06
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 34 additions and 19 deletions

View file

@ -11,8 +11,10 @@ extern "C" {
typedef thespian_result (*thespian_receiver)(thespian_behaviour_state,
thespian_handle from, cbor_buffer);
typedef void (*thespian_receiver_dtor)(thespian_behaviour_state);
void thespian_receive(thespian_receiver, thespian_behaviour_state);
void thespian_receive(thespian_receiver, thespian_behaviour_state,
thespian_receiver_dtor);
bool thespian_get_trap();
bool thespian_set_trap(bool);