本文整理汇总了C++中pthread_key_delete函数的典型用法代码示例。如果您正苦于以下问题:C++ pthread_key_delete函数的具体用法?C++ pthread_key_delete怎么用?C++ pthread_key_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pthread_key_delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wrap_pthread_key_delete
static int wrap_pthread_key_delete(pthread_key_t key)
{
/* this is clumsy: having to key_create lessens key_delete's chances
of being interrupted - test not definite */
int err2;
WRAP_START
while(
!(err2 = pthread_key_create(&key, NULL))
&&
!(err = pthread_key_delete(key))
);
if (err2)
err = -3; //meaning the dependecy failed
WRAP_END
}
示例2: _MXML_FINI
static void
_MXML_FINI(void)
{
_mxml_global_t *global; /* Global data */
if (_mxml_key != -1)
{
if ((global = (_mxml_global_t *)pthread_getspecific(_mxml_key)) != NULL)
_mxml_destructor(global);
pthread_key_delete(_mxml_key);
_mxml_key = -1;
}
}
示例3: tMPI_Thread_key_delete
int tMPI_Thread_key_delete(tMPI_Thread_key_t key)
{
int ret;
ret=pthread_key_delete((key.key->pkey));
free(key.key);
if(ret!=0)
{
tMPI_Fatal_error(TMPI_FARGS,"Failed to delete thread key, rc=%d.",ret);
fflush(stderr);
}
return ret;
}
示例4: delete_msgque
void delete_msgque(void *arg)
{
msgque_t que = (msgque_t)arg;
lnode *n;
if(que->destroy_function){
while((n = LLIST_POP(lnode*,&que->share_que))!=NULL)
que->destroy_function((void*)n);
}
mutex_destroy(&que->mtx);
pthread_key_delete(que->t_key);
free(que);
#ifdef _DEBUG
printf("on_que_destroy\n");
#endif
}
示例5: OS_FreeTLSIndex
bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
{
if (nIndex == OS_INVALID_TLS_INDEX) {
assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
return false;
}
//
// Delete the global pool key.
//
if (pthread_key_delete(nIndex) == 0)
return true;
else
return false;
}
示例6: Test_Thread
rtems_task Test_Thread( rtems_task_argument arg )
{
void *argument = (void *) arg;
int sc;
puts( "Test_Thread - key pthread_setspecific - OK" );
sc = pthread_setspecific( key, argument );
rtems_test_assert( !sc );
puts( "Test_Thread - pthread key delete - OK" );
sc = pthread_key_delete( key );
rtems_test_assert( sc == 0 );
puts( "Test_Thread - exit but don't run key destructors - OK" );
rtems_task_delete( RTEMS_SELF );
}
示例7: ENABLE
MachineThreads::~MachineThreads()
{
#if ENABLE(JSC_MULTIPLE_THREADS)
if (m_threadSpecific) {
int error = pthread_key_delete(m_threadSpecific);
ASSERT_UNUSED(error, !error);
}
MutexLocker registeredThreadsLock(m_registeredThreadsMutex);
for (Thread* t = m_registeredThreads; t;) {
Thread* next = t->next;
delete t;
t = next;
}
#endif
}
示例8: checklock_stop
/** stop checklocks */
void checklock_stop(void)
{
if(key_created) {
int i;
key_deleted = 1;
if(check_locking_order)
fclose(thread_infos[0]->order_info);
free(thread_infos[0]);
thread_infos[0] = NULL;
for(i = 0; i < THRDEBUG_MAX_THREADS; i++)
log_assert(thread_infos[i] == NULL);
/* should have been cleaned up. */
LOCKRET(pthread_key_delete(thr_debug_key));
key_created = 0;
}
}
示例9: wrap_pthread_key_create
static int wrap_pthread_key_create(pthread_key_t *key,
void (*destructor)(void*))
{
/* this is clumsy: having to key_create lessens key_delete's chances
of being interrupted - test not definite */
int err2;
WRAP_START
while(
!(err = pthread_key_create(key, destructor))
&&
!(err2 = pthread_key_delete(*key))
);
if (!err && err2)
err = -3; //meaning the dependecy failed
WRAP_END
}
示例10: JNI_OnUnload
JNIEXPORT void JNICALL
JNI_OnUnload(JavaVM *jvm, void *reserved)
{
JNIEnv *env;
destroy_native_crash_handler();
if (jvm->GetEnv((void **) &env, JNI_VERSION))
return;
env->DeleteGlobalRef(gfq.clazz);
env->DeleteGlobalRef(gfq.String.clazz);
env->DeleteGlobalRef(gfq.IllegalArgumentException.clazz);
pthread_key_delete(jni_env_key);
}
示例11: workaroundHook
/**
* Simple holder of work-arounds for link-time issues.
*/
void workaroundHook()
{
pthread_key_t key = {0};
int ret = pthread_key_create(&key, NULL);
if (!ret)
{
void *ptr = pthread_getspecific(key); // should return NULL
ret = pthread_setspecific(key, &ptr);
if (ret)
{
// Something went wrong. Since this is a stub, we don't care.
}
pthread_key_delete(key);
}
}
示例12: main
int main(void)
{
pthread_t thid1;
int status;
pthread_key_create(&keyid,NULL);
if (pthread_create(&thid1,NULL,(void *)func2,NULL))
printf("创建线程1失败\n");
printf("主线程:%lu\n",pthread_self());
pthread_join(thid1,(void *)&status);
pthread_key_delete(keyid);
return 0;
}
示例13: while
void PoolMemoryAllocator::cleanup()
{
BlockChainPtr p = s_blocks;
while(p != 0) {
BlockChainPtr pNext = p->m_next;
free(p);
p = pNext;
}
#ifndef OGDF_MEMORY_POOL_NTS
#ifdef OGDF_NO_COMPILER_TLS
pthread_key_delete(s_tpKey);
#endif
delete s_criticalSection;
#endif
}
示例14: git_threads_shutdown
void git_threads_shutdown(void)
{
if (_tls_init) {
void *ptr = pthread_getspecific(_tls_key);
pthread_setspecific(_tls_key, NULL);
git__free(ptr);
}
pthread_key_delete(_tls_key);
_tls_init = 0;
git_mutex_free(&git__mwindow_mutex);
/* Shut down any subsystems that have global state */
git_hash_global_shutdown();
git_futils_dirs_free();
}
示例15: main
int main()
{
pthread_t tid[THREAD_NUM];
int i;
pthread_key_create(&key, NULL);
#pragma omp parallel for
for ( i = 0; i < THREAD_NUM; i++ )
pthread_create(&tid[i], NULL, thread, NULL);
#pragma omp parallel for
for ( i = 0; i < THREAD_NUM; i++ )
pthread_join(tid[i], NULL);
pthread_key_delete(key);
return 0;
}