Hi,
Zhu Zihao <[email protected]> skribis:
> In Guile FFI programming, we have procedure->pointer, which makes a
> Scheme procedure a foreign callback. And foreign library call use this
> callback.
>
> However, if this callback is called in a another foreign thread. The scheme
> context is not properly setup, It may cause crash or UB.
>
> IIUC, the procedure invoker "invoke_closure" defined in foreign.c
> doesn't use scm_with_guile. If we use scm_with_guile to make a foreign
> callback, would it be OK to execute Scheme procedure in multithreading
> context?
Yes, it should be.
Could you come up with a minimal reproducer and maybe even a fix, now
that you likely found the solution? :-)
Thanks in advance,
Ludo’.
PS: It may be best to use bug-guile to reduce the chances that the issue
gets lost.