guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Send scheme procedure as callback to foreign thread.


From: Zhu Zihao
Subject: Send scheme procedure as callback to foreign thread.
Date: Tue, 11 Oct 2022 14:37:01 +0800
User-agent: mu4e 1.8.9; emacs 29.0.50

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?
-- 
Retrieve my PGP public key:

  gpg --recv-keys B3EBC086AB0EBC0F45E0B4D433DB374BCEE4D9DC

Zihao

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]