From 1e6e693aad9af55fb3a4722c862edefd31896bbb Mon Sep 17 00:00:00 2001 From: compudj Date: Sun, 11 Feb 2007 20:43:22 +0000 Subject: [PATCH] fix usertrace fast git-svn-id: http://ltt.polymtl.ca/svn@2384 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt-usertrace/ltt/ltt-usertrace-fast.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ltt-usertrace/ltt/ltt-usertrace-fast.h b/ltt-usertrace/ltt/ltt-usertrace-fast.h index 536362fb..5bcec27d 100644 --- a/ltt-usertrace/ltt/ltt-usertrace-fast.h +++ b/ltt-usertrace/ltt/ltt-usertrace-fast.h @@ -367,6 +367,7 @@ static inline void * __attribute__((no_instrument_function)) ltt_reserve_slot( int commit_count, reserve_count; int ret; sigset_t oldset, set; + int signals_disabled = 0; do { offset_old = atomic_read(<t_buf->offset); @@ -418,12 +419,14 @@ static inline void * __attribute__((no_instrument_function)) ltt_reserve_slot( * Signals are kept disabled to make sure we win the cmpxchg. */ /* Disable signals */ - ret = sigfillset(&set); - if(ret) perror("LTT Error in sigfillset\n"); - - ret = pthread_sigmask(SIG_BLOCK, &set, &oldset); - if(ret) perror("LTT Error in pthread_sigmask\n"); - + if(!signals_disabled) { + ret = sigfillset(&set); + if(ret) perror("LTT Error in sigfillset\n"); + + ret = pthread_sigmask(SIG_BLOCK, &set, &oldset); + if(ret) perror("LTT Error in pthread_sigmask\n"); + signals_disabled = 1; + } sem_wait(<t_buf->writer_sem); } @@ -547,7 +550,7 @@ static inline void * __attribute__((no_instrument_function)) ltt_reserve_slot( * sem_wait does in fact win the cmpxchg for the offset. We only call * these system calls on buffer boundaries because of their performance * cost. */ - if(reserve_commit_diff == 0) { + if(signals_disabled) { ret = pthread_sigmask(SIG_SETMASK, &oldset, NULL); if(ret) perror("LTT Error in pthread_sigmask\n"); } -- 2.34.1