Returning errno as a second value

Luís Oliveira luismbo at gmail.com
Mon Aug 12 20:54:02 UTC 2013


Felix Filozov <ffilozov at gmail.com> writes:

> The implementation uses locking, so its efficiency could improved. I'm
> interested in your suggestions on how to do that.

Indeed, this interface is much better from the user's point of view. I
feel a bit uneasy about the implementation though.

I found this message from Duane Rettig
(<https://groups.google.com/forum/#!msg/comp.lang.lisp/7rhuvXaiR_g/AQ2-i6-74s4J>)
that suggests that the nearest ACL gets to thread-local variables is by
defining a special variable then adding it to the list of default
bindings.

How about an interface like this?

  (with-errno
    (some-foreign-function-with-the-errno-option-on)
    (get-errno))

or perhaps

  (with-errno (errno)
    (some-foreign-function-with-the-errno-option-on)
    errno)

Cheers,

-- 
Luís Oliveira
http://kerno.org/~luis




More information about the cffi-devel mailing list