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:
parent
b16a47efae
commit
5a729b6d06
3 changed files with 34 additions and 19 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue