- Timestamp:
- Aug 23, 2012, 8:52:20 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/Changelog
r405 r408 1 1 3.0.6: 2 * fix for --enable-ptrace: make the save_tv variable thread specific 2 3 * fix bug in inotify code which made it follow symlinks (by [anonymous]) 3 4 * fix two missing SH_MUTEX_LOCK(mutex_thread_nolog) (by [anonymous]) -
trunk/include/sh_unix.h
r405 r408 374 374 #endif 375 375 #endif 376 extern struct timeval save_tv;376 void sh_set_save_tv(); 377 377 #endif 378 378 … … 397 397 398 398 #ifdef HAVE_GETTIMEOFDAY 399 gettimeofday(&save_tv, NULL);399 sh_set_save_tv(); 400 400 #endif 401 401 -
trunk/src/sh_pthread.c
r405 r408 31 31 int rc = 0; 32 32 #ifdef SH_STEALTH 33 extern int sh_g_thread(void);34 35 rc = sh_g_thread(); 36 if (rc != 0)37 return rc;33 do { 34 extern int sh_g_thread(void); 35 36 rc = sh_g_thread(); 37 } while (0); 38 38 #endif 39 39 -
trunk/src/sh_unix.c
r402 r408 5401 5401 5402 5402 #ifdef HAVE_GETTIMEOFDAY 5403 struct timeval save_tv; 5403 5404 #if defined(HAVE_PTHREAD) 5405 5406 static pthread_key_t gSaveTv_key; 5407 static pthread_once_t gSaveTv_key_once = PTHREAD_ONCE_INIT; 5408 5409 static inline void make_gSaveTv_key() 5410 { 5411 (void) pthread_key_create(&gSaveTv_key, free); 5412 } 5413 5414 static inline struct timeval * sh_get_save_tv() 5415 { 5416 void * ptr; 5417 struct timeval * save_tv; 5418 5419 (void) pthread_once(&gSaveTv_key_once, make_gSaveTv_key); 5420 5421 if ((ptr = pthread_getspecific(gSaveTv_key)) == NULL) 5422 { 5423 ptr = malloc(sizeof(struct timeval)); 5424 if (ptr) 5425 { 5426 save_tv = (struct timeval*) ptr; 5427 (void) pthread_setspecific(gSaveTv_key, ptr); 5428 } 5429 else 5430 { 5431 return NULL; 5432 } 5433 } 5434 else 5435 { 5436 save_tv = (struct timeval*) ptr; 5437 } 5438 return save_tv; 5439 } 5440 5441 void sh_set_save_tv() 5442 { 5443 struct timeval * save_tv = sh_get_save_tv(); 5444 if (save_tv) 5445 gettimeofday(save_tv, NULL); 5446 return; 5447 } 5448 5449 /* !defined(HAVE_PTHREAD) */ 5450 #else 5451 5452 static struct timeval * sSaveTv = NULL; 5453 5454 static inline struct timeval * sh_get_save_tv() 5455 { 5456 return sSaveTv; 5457 } 5458 void sh_set_save_tv() 5459 { 5460 gettimeofday(sSaveTv, NULL); 5461 } 5462 #endif 5463 5464 /* #ifdef HAVE_GETTIMEOFDAY */ 5404 5465 #endif 5405 5466 … … 5409 5470 struct timeval tv; 5410 5471 long difftv; 5472 struct timeval * save_tv = sh_get_save_tv(); 5473 5474 gettimeofday(&tv, NULL); 5411 5475 5412 gettimeofday(&tv, NULL); 5413 difftv = (tv.tv_sec - save_tv.tv_sec) * 1000000 + 5414 (tv.tv_usec - save_tv.tv_usec); 5476 difftv = (tv.tv_sec - save_tv->tv_sec) * 1000000 + 5477 (tv.tv_usec - save_tv->tv_usec); 5415 5478 if (difftv > 500000) 5416 5479 raise(SIGKILL);
Note:
See TracChangeset
for help on using the changeset viewer.