uti: Make tracee pthread-detached
Change-Id: I672ee18739b956980901b63e55ee3ebc192b4e56
This commit is contained in:
@@ -1032,7 +1032,7 @@ struct thread_data_s {
|
|||||||
int terminate;
|
int terminate;
|
||||||
int remote_tid;
|
int remote_tid;
|
||||||
int remote_cpu;
|
int remote_cpu;
|
||||||
int joined;
|
int joined, detached;
|
||||||
pthread_mutex_t *lock;
|
pthread_mutex_t *lock;
|
||||||
pthread_barrier_t *init_ready;
|
pthread_barrier_t *init_ready;
|
||||||
} *thread_data;
|
} *thread_data;
|
||||||
@@ -1878,7 +1878,7 @@ join_all_threads()
|
|||||||
do {
|
do {
|
||||||
live_thread = 0;
|
live_thread = 0;
|
||||||
for (tp = thread_data; tp; tp = tp->next) {
|
for (tp = thread_data; tp; tp = tp->next) {
|
||||||
if (tp->joined)
|
if (tp->joined || tp->detached)
|
||||||
continue;
|
continue;
|
||||||
live_thread = 1;
|
live_thread = 1;
|
||||||
pthread_join(tp->thread_id, NULL);
|
pthread_join(tp->thread_id, NULL);
|
||||||
@@ -3245,6 +3245,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 */
|
||||||
|
if ((rc = pthread_detach(my_thread->thread_id)) != 0) {
|
||||||
|
fprintf(stderr, "%s: pthread_detach returned %d\n", __FUNCTION__, rc);
|
||||||
|
}
|
||||||
|
my_thread->detached = 1; /* Skip join in join_all_threads() */
|
||||||
|
|
||||||
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) {
|
||||||
fprintf(stderr, "util_thread2: %d\n", rc);
|
fprintf(stderr, "util_thread2: %d\n", rc);
|
||||||
|
|||||||
Reference in New Issue
Block a user