| 761 | } |
| 762 | |
| 763 | static 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 | |
| 793 | static int pthread_create(pthread_t *th, pthread_attr_t *attr, void *(* func)(void *), void *arg) |
| 794 | { |
nothing calls this directly
no test coverage detected