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

Function pthread_create

include/hamlib/winpthreads.h:793–834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

791}
792
793static int pthread_create(pthread_t *th, pthread_attr_t *attr, void *(* func)(void *), void *arg)
794{
795 struct _pthread_v *tv = (struct _pthread_v *)malloc(sizeof(struct _pthread_v));
796 unsigned ssize = 0;
797
798 if (!tv) return 1;
799
800 *th = tv;
801
802 /* Save data in pthread_t */
803 tv->ret_arg = arg;
804 tv->func = func;
805 tv->clean = NULL;
806 tv->cancelled = 0;
807 tv->p_state = PTHREAD_DEFAULT_ATTR;
808 tv->keymax = 0;
809 tv->keyval = NULL;
810 tv->h = (HANDLE) -1;
811
812 if (attr)
813 {
814 tv->p_state = attr->p_state;
815 ssize = (unsigned int)attr->s_size;
816 }
817
818 /* Make sure tv->h has value of -1 */
819 _ReadWriteBarrier();
820
821 tv->h = (HANDLE) _beginthreadex(NULL, ssize, (_beginthreadex_proc_type)pthread_create_wrapper, tv, 0, NULL);
822
823 /* Failed */
824 if (!tv->h) return 1;
825
826 if (tv->p_state & PTHREAD_CREATE_DETACHED)
827 {
828 CloseHandle(tv->h);
829 _ReadWriteBarrier();
830 tv->h = 0;
831 }
832
833 return 0;
834}
835
836static int pthread_join(pthread_t t, void **res)
837{

Callers 15

pstrotator_rot_openFunction · 0.85
start_threadFunction · 0.85
anytone_openFunction · 0.85
gr_openFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
rig_poll_routine_startFunction · 0.85
async_data_handler_startFunction · 0.85
morse_data_handler_startFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected