facebook/hhvm — pull request #2385 by danslo (2014-04-10 00:42:16+00:00)
Title: avoid using memory manager in pthread destructor

When a pthread exits, it will call the destructor function specified as
second argument to pthread_key_create. For some objects, this means
ThreadLocalOnThreadExit which will simply delete the object.

In the case of BigintData, the destructor will try to access a property
for cleanup (freelist). Accessing this property requires a call to
pthread_getspecific. Calling pthread_getspecific from a pthread
destructor is undefined behavior and returns a nullptr on OS X
(and possibly BSD).

Let's avoid the need for pthread_getspecific by passing freelist as an
argument to destroy_freelist instead.