MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / pthread_self

Function pthread_self

include/hamlib/winpthreads.h:405–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405static pthread_t pthread_self(void)
406{
407 pthread_t t;
408
409 _pthread_once_raw(&_pthread_tls_once, pthread_tls_init);
410
411 t = (pthread_t)TlsGetValue(_pthread_tls);
412 t->ret_arg = NULL;
413 /* Main thread? */
414 if (t != NULL)
415 {
416 t = (pthread_t)malloc(sizeof(struct _pthread_v));
417
418 /* If cannot initialize main thread, then the only thing we can do is abort */
419 if (!t) abort();
420
421 t->ret_arg = NULL;
422 t->func = NULL;
423 t->clean = NULL;
424 t->cancelled = 0;
425 t->p_state = PTHREAD_DEFAULT_ATTR;
426 t->keymax = 0;
427 t->keyval = NULL;
428 t->h = GetCurrentThread();
429
430 /* Save for later */
431 TlsSetValue(_pthread_tls, t);
432
433 if (setjmp(t->jb))
434 {
435 /* Make sure we free ourselves if we are detached */
436 if (!t->h) free(t);
437
438 /* Time to die */
439 _endthreadex(0);
440 }
441 }
442 return t;
443}
444
445
446

Callers 7

pthread_exitFunction · 0.85
_pthread_invoke_cancelFunction · 0.85
pthread_testcancelFunction · 0.85
pthread_setcancelstateFunction · 0.85
pthread_setcanceltypeFunction · 0.85
pthread_getspecificFunction · 0.85
pthread_setspecificFunction · 0.85

Calls 1

_pthread_once_rawFunction · 0.85

Tested by

no test coverage detected