MCPcopy Create free account
hub / github.com/apache/impala / AddDestructor

Function AddDestructor

be/src/kudu/util/threadlocal.cc:71–84  ·  view source on GitHub ↗

Adds a destructor to the list.

Source from the content-addressed store, hash-verified

69
70// Adds a destructor to the list.
71void AddDestructor(void (*destructor)(void*), void* arg) {
72 GoogleOnceInit(&once, &CreateKey);
73
74 // Returns NULL if nothing is set yet.
75 std::unique_ptr<PerThreadDestructorList> p(new PerThreadDestructorList());
76 p->destructor = destructor;
77 p->arg = arg;
78 p->next = reinterpret_cast<PerThreadDestructorList*>(pthread_getspecific(destructors_key));
79 int ret = pthread_setspecific(destructors_key, p.release());
80 // The only time this check should fail is if we are out of memory, or if
81 // somehow key creation failed, which should be caught by the above CHECK.
82 CHECK_EQ(0, ret) << "pthread_setspecific() failed, cannot update destructor list: "
83 << "error " << ret << ": " << ErrnoToString(ret);
84}
85
86} // namespace internal
87} // namespace threadlocal

Callers 2

CreateAndRegisterTLSMethod · 0.85

Calls 3

GoogleOnceInitFunction · 0.85
ErrnoToStringFunction · 0.85
releaseMethod · 0.45

Tested by

no test coverage detected