Changeset 39604 in webkit for trunk/JavaScriptCore/wtf/ThreadSpecific.h
- Timestamp:
- Jan 5, 2009, 10:13:05 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/ThreadSpecific.h
r35194 r39604 98 98 { 99 99 Data* data = static_cast<Data*>(ptr); 100 data->value->~T(); 101 fastFree(data->value); 102 // Only reset the pointer after value destructor finishes - otherwise, code in destructor could trigger 103 // re-creation of the object. 100 104 pthread_setspecific(data->owner->m_key, 0); 101 delete data->value;102 105 delete data; 103 106 } … … 112 115 T* ptr = static_cast<T*>(get()); 113 116 if (!ptr) { 114 ptr = new T(); 117 // Set up thread-specific value's memory pointer before invoking constructor, in case any function it calls 118 // needs to access the value, to avoid recursion. 119 ptr = static_cast<T*>(fastMalloc(sizeof(T))); 115 120 set(ptr); 121 new (ptr) T; 116 122 } 117 123 return ptr;
Note:
See TracChangeset
for help on using the changeset viewer.