On 15/05/2015 17:24, Marvin Humphrey wrote:
I've been thinking hard about this problem over the last few days. In the
short term, I think we should move the global error variable out of Clownfish
and into Lucy. We can monkey patch the Clownfish namespace if need be for
compatibility's sake.
I also gave it some thought. A simple solution is to store the global error
using the OS's thread-local storage like we do in the C bindings, and call
runtime.LockOSThread() if the global error is set:
https://golang.org/pkg/runtime/#LockOSThread
Downsides:
- LockOSThread can make highly concurrent code less efficient.
- An application could call UnlockOSThread and undo the effect
of LockOSThread resulting in the wrong global error being
returned.
Both are minor issues, IMO. It looks like the only clean solution is to
completely avoid thread-local variables which would mean a considerable
rewrite of some Lucy code.
The v2 branch looks good, and compiles and passes tests on my Mac laptop. +1
to merge!
The branch is now merged.
Nick