Felix Filozov <ffilozov@gmail.com> writes:All CLs I'm aware of behave like that, yes.
> If I understood Duane Rettig's response correctly, when a thread binds
> a special variable using a let, that binding is only visible for that
> particular thread. Is this how other Lisps behave?
Why is that? I was thinking that the interface could work as follows:
> With that in mind, in order to make with-errno work, the foreign
> function call expression would have to be identified and bound with a
> let.
1. WITH-ERRNO establishes a dynamic binding (cffi-sys:*errno* for
instance)
2. FOREIGN-FUNCALL does something like
(when (boundp '*errno*) (setf *errno* <errno>))
3. GET-ERRNO simply returns the value of *errno*
That would be much simpler wouldn't it? I wonder if we can avoid
> You mentioned that a foreign function call could return errno as the
> first value, how about returning it as the last?
consing, at least for the single return value case... If all else fails,
simply documenting that grabbing errno entails discarding all but the
first return value might be a solution.
I don't have any good ideas on that front.
> Another alternative is to optimize the way synchronization is done, so
> that we could improve the thread-local code I wrote before.
Luís