Functions returning structs are not thread-safe
Bug #1474211 reported by
Elias Martenson
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CFFI |
In Progress
|
Undecided
|
Unassigned |
Bug Description
When DEFCFUN is used to declare a function that returns a struct, the resulting function calls CFFI:FOREIGN-
Note that this code-path is only followed for functions that are called through libffi (i.e. functions that returns structs). Plain functions are not affected by this.
PREPARE-FUNCTION should use a mutex or other mechanism to prevent parallel access to *CIF-TABLE*.
Another potential solution would be to run DEFCFUN during compile-time, although I don't know the implications of this.
To post a comment you must log in.
Liam's fix at https:/ /github. com/cffi/ cffi/commit/ bb5577baffae013 7ae4087ee95cbd2 df31b7ca87 (and discussion on IRC) suggests this is only an issue during compilation, but this bug report suggests otherwise. Which is which?