in reply to XS/C, threads, and calling call_sv() with a code ref
If you *want* a threaded perl experience, then go with the earlier answers. But if all you really wanted was event-driven callbacks, you could have the C thread just write a byte into a pipe (which you're holding both ends of), then have the main perl interpreter read from the pipe and dispatch to callbacks right from perl-space, in a single-threaded manner. You can use something like select() or AnyEvent to wait for data to arrive on the pipe.
|
|---|