uti: mcexec: Fix error check of pthread_detach

Change-Id: Idda8e060641bbd7b01c50163140a2c5f7466d193
This commit is contained in:
Masamichi Takagi
2018-09-02 17:10:13 +09:00
parent ee299b5780
commit af7f61db49

View File

@@ -3283,11 +3283,12 @@ util_thread(struct thread_data_s *my_thread, unsigned long uctx_pa, int remote_t
ioctl(fd, MCEXEC_UP_UTI_ATTR, &desc); ioctl(fd, MCEXEC_UP_UTI_ATTR, &desc);
} }
/* Synchronize detached state with the McKernel counterpart */ /* McKernel would create the thread detached, so detach myself */
if ((rc = pthread_detach(my_thread->thread_id)) != 0) { if ((rc = pthread_detach(my_thread->thread_id)) < 0) {
fprintf(stderr, "%s: pthread_detach returned %d\n", __FUNCTION__, rc); fprintf(stderr, "%s: ERROR pthread_detach returned %d\n", __FUNCTION__, rc);
goto out;
} }
my_thread->detached = 1; /* Skip join in join_all_threads() */ my_thread->detached = 1;
if ((rc = switch_ctx(fd, MCEXEC_UP_UTIL_THREAD2, param, lctx, rctx)) if ((rc = switch_ctx(fd, MCEXEC_UP_UTIL_THREAD2, param, lctx, rctx))
< 0) { < 0) {