File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -410,7 +410,6 @@ TaskTracer::Result TaskTracer::SignalTrace(pthread_t worker_tid) {
410410 return Result::MakeErrorResult (" Fail to pthread_sigqueue: %s" , berror ());
411411 }
412412 }
413- _inuse_signal_syncs.push_back (signal_sync);
414413
415414 // Wait for the signal handler to complete.
416415 butil::Timer timer;
@@ -435,13 +434,14 @@ TaskTracer::Result TaskTracer::SignalTrace(pthread_t worker_tid) {
435434 if (EINTR == errno) {
436435 continue ;
437436 }
437+ // Extend the lifetime of `signal_sync' to
438+ // avoid it being destroyed in the signal handler.
439+ _inuse_signal_syncs.push_back (signal_sync);
438440 return Result::MakeErrorResult (" Fail to poll: %s" , berror ());
439441 }
440442 break ;
441443 }
442- // Remove the successful SignalSync.
443- _inuse_signal_syncs.pop_back ();
444-
444+
445445 return signal_sync->result ;
446446}
447447
You can’t perform that action at this time.
0 commit comments