morellon / rrd-ffi

A ruby wrapper for librrd (rrdtool) using ffi.
MIT License
71 stars 20 forks source link

Thread-local instead of class variables for storing pointers to be freed #16

Closed neilljordan closed 12 years ago

neilljordan commented 12 years ago

In applications with multiple threads, the class variables in RRD::Wrapper storing pointers were sporadically causing segfaults since they could be freed multiple times or freed while in use by another thread. Not sure if you'd rather refactor another way, but using thread-local storage seemed to be the least intrusive fix.

morellon commented 12 years ago

It looks good to me. Thanks for contributing