dark-panda / ffi-geos

ffi-geos is an implementation of the GEOS Ruby bindings in Ruby via FFI.
MIT License
58 stars 15 forks source link

Remove thread locals #18

Closed sempervictus closed 11 years ago

sempervictus commented 11 years ago

This PR replaces Thread local storage with instance variables so as to encapsulate state within the object.

Running on Rubinius 2.0.0.rc1 (1.9.3 be5c0cb8) rake test produces:

Finished in 1.47699s
272 tests, 1107 assertions, 0 failures, 0 errors, 0 skips
dark-panda commented 11 years ago

GEOS has a reentrant interface that uses a context handle to store some information in and passes it along to all of its reentrant functions within the CAPI, hence why we store that handle in thread storage rather than in an instance variable. I don't think it would be a good idea to share a single instance of this handle across all threads since that would defeat the purpose of having a thread-safe handle in the first place.

dark-panda commented 11 years ago

Closed, as we can't share handles across threads.