- pthread_attr_setschedparam(&a, &sp);
-
- // this is the point of no return
- p_internal->state = STATE_RUNNING;
- if (pthread_create(&p_internal->thread_id, &a,
- wxThreadInternal::PthreadStart, (void *)this) != 0) {
- p_internal->state = STATE_IDLE;
+ pthread_attr_setschedparam(&a, &sp);
+
+ // this is the point of no return
+ p_internal->state = STATE_RUNNING;
+ if (pthread_create(&p_internal->thread_id, &a,
+ wxThreadInternal::PthreadStart, (void *)this) != 0)
+ {
+ p_internal->state = STATE_IDLE;
+ pthread_attr_destroy(&a);
+ return wxTHREAD_NO_RESOURCE;
+ }