소스 검색

revert mutex "optimization" that turned out to be worse

Rich Felker 14 년 전
부모
커밋
8524d6536c
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/thread/pthread_mutex_trylock.c

+ 1 - 1
src/thread/pthread_mutex_trylock.c

@@ -7,7 +7,7 @@ int pthread_mutex_trylock(pthread_mutex_t *m)
 	pthread_t self;
 
 	if (m->_m_type == PTHREAD_MUTEX_NORMAL)
-		return (m->_m_lock || a_swap(&m->_m_lock, 1)) ? EBUSY : 0;
+		return -a_swap(&m->_m_lock, 1) & EBUSY;
 
 	self = pthread_self();
 	tid = self->tid | 0x80000000;