| 64 | |
| 65 | |
| 66 | int pthread_create(pthread_t *thread_id, const pthread_attr_t *attr, |
| 67 | pthread_handler func, void *param) |
| 68 | { |
| 69 | uintptr_t handle; |
| 70 | struct thread_start_parameter *par; |
| 71 | unsigned int stack_size; |
| 72 | int error_no; |
| 73 | DBUG_ENTER("pthread_create"); |
| 74 | |
| 75 | par= (struct thread_start_parameter *)malloc(sizeof(*par)); |
| 76 | if (!par) |
| 77 | goto error_return; |
| 78 | |
| 79 | par->func= func; |
| 80 | par->arg= param; |
| 81 | stack_size= attr?attr->dwStackSize:0; |
| 82 | |
| 83 | handle= _beginthreadex(NULL, stack_size , pthread_start, par, 0, thread_id); |
| 84 | if (!handle) |
| 85 | goto error_return; |
| 86 | DBUG_PRINT("info", ("thread id=%u",*thread_id)); |
| 87 | |
| 88 | /* Do not need thread handle, close it */ |
| 89 | CloseHandle((HANDLE)handle); |
| 90 | DBUG_RETURN(0); |
| 91 | |
| 92 | error_return: |
| 93 | error_no= errno; |
| 94 | DBUG_PRINT("error", |
| 95 | ("Can't create thread to handle request (error %d)",error_no)); |
| 96 | DBUG_RETURN(error_no); |
| 97 | } |
| 98 | |
| 99 | |
| 100 | void pthread_exit(void *a) |
no outgoing calls