Skip to content

Commit

Permalink
i#2153: fix disabled -prof_pcs for start/stop API
Browse files Browse the repository at this point in the history
i#2089 exposed a bug in -prof_pcs for the start/stop API where disabling an
itimer fails to clear the current values, resulting in a restart of the
itimer thinking it's still live and not actually re-enabling it.
We fix that here.

Fixes #2153

Review-URL: https://codereview.appspot.com/320040043
  • Loading branch information
derekbruening committed Jan 26, 2017
1 parent 16f3863 commit 7cdd07b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/unix/signal.c
Expand Up @@ -5962,7 +5962,7 @@ init_itimer(dcontext_t *dcontext, bool first)
info->itimer = (thread_itimer_info_t (*)[NUM_ITIMERS])
global_heap_alloc(sizeof(*info->itimer) HEAPACCT(ACCT_OTHER));
} else {
/* for simplicity and parllel w/ shared we allocate proactively */
/* for simplicity and parallel w/ shared we allocate proactively */
info->itimer = (thread_itimer_info_t (*)[NUM_ITIMERS])
heap_alloc(dcontext, sizeof(*info->itimer) HEAPACCT(ACCT_OTHER));
}
Expand Down Expand Up @@ -6000,6 +6000,8 @@ set_actual_itimer(dcontext_t *dcontext, int which, thread_sig_info_t *info,
} else {
LOG(THREAD, LOG_ASYNCH, 2, "disabling itimer %d\n", which);
memset(&val, 0, sizeof(val));
(*info->itimer)[which].actual.value = 0;
(*info->itimer)[which].actual.interval = 0;
}
rc = setitimer_syscall(which, &val, NULL);
return (rc == SUCCESS);
Expand Down Expand Up @@ -6273,7 +6275,7 @@ stop_itimer(dcontext_t *dcontext)
stop = true;
if (stop) {
/* Disable all DR itimers b/c this set of threads sharing this
* itimer is now compmletely native
* itimer is now completely native
*/
int which;
LOG(THREAD, LOG_ASYNCH, 2, "stopping DR itimers from thread "TIDFMT"\n",
Expand Down

0 comments on commit 7cdd07b

Please sign in to comment.