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

Function pthread_create_wrapper

include/hamlib/winpthreads.h:763–791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761}
762
763static int pthread_create_wrapper(void *args)
764{
765 struct _pthread_v *tv = (struct _pthread_v*)args;
766
767 _pthread_once_raw(&_pthread_tls_once, pthread_tls_init);
768
769 TlsSetValue(_pthread_tls, tv);
770
771 if (!setjmp(tv->jb))
772 {
773 /* Call function and save return value */
774 tv->ret_arg = tv->func(tv->ret_arg);
775
776 /* Clean up destructors */
777 _pthread_cleanup_dest(tv);
778 }
779
780 /* If we exit too early, then we can race with create */
781 while (tv->h == (HANDLE) -1)
782 {
783 YieldProcessor();
784 _ReadWriteBarrier();
785 }
786
787 /* Make sure we free ourselves if we are detached */
788 if (!tv->h) free(tv);
789
790 return 0;
791}
792
793static int pthread_create(pthread_t *th, pthread_attr_t *attr, void *(* func)(void *), void *arg)
794{

Callers

nothing calls this directly

Calls 2

_pthread_once_rawFunction · 0.85
_pthread_cleanup_destFunction · 0.85

Tested by

no test coverage detected