Implement compile time debug mode for thread locks.

This commit is contained in:
John Birrell 1998-06-09 08:32:23 +00:00
parent 3d853e107e
commit 86af3ff9b0
3 changed files with 11 additions and 11 deletions

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: _spinlock_stub.c,v 1.1 1998/03/09 06:46:21 jb Exp $ * $Id: _spinlock_stub.c,v 1.2 1998/04/29 09:02:16 jb Exp $
* *
*/ */
@ -44,21 +44,21 @@
* with libpthread. * with libpthread.
*/ */
#pragma weak _spinlock=_spinlock_stub #pragma weak _spinlock=_spinlock_stub
#pragma weak _atomic_unlock=_atomic_unlock_stub #pragma weak _spinlock_debug=_spinlock_debug_stub
/* /*
* This function is a stub for the spinlock function in libpthread. * This function is a stub for the spinlock function in libpthread.
*/ */
void void
_spinlock_stub(long *lck) _spinlock_stub(spinlock_t *lck)
{ {
} }
/* /*
* This function is a stub for the _atomic_unlock function in libpthread. * This function is a stub for the debug spinlock function in libpthread.
*/ */
void void
_atomic_unlock_stub(long *lck) _spinlock_debug_stub(spinlock_t *lck, char *fname, int lineno)
{ {
} }
#endif #endif

View File

@ -50,11 +50,11 @@ isatty(fd)
struct termios t; struct termios t;
#ifdef _THREAD_SAFE #ifdef _THREAD_SAFE
if (_thread_fd_lock(fd, FD_READ, NULL,__FILE__,__LINE__) == 0) { if (_FD_LOCK(fd, FD_READ, NULL) == 0) {
#endif #endif
retval = (tcgetattr(fd, &t) != -1); retval = (tcgetattr(fd, &t) != -1);
#ifdef _THREAD_SAFE #ifdef _THREAD_SAFE
_thread_fd_unlock(fd, FD_READ); _FD_UNLOCK(fd, FD_READ);
} else { } else {
retval = 0; retval = 0;
} }

View File

@ -59,9 +59,9 @@ ttyname(int fd)
{ {
char *ret; char *ret;
if (_thread_fd_lock(fd, FD_READ, NULL, __FILE__, __LINE__) == 0) { if (_FD_LOCK(fd, FD_READ, NULL) == 0) {
ret = __ttyname_basic(fd); ret = __ttyname_basic(fd);
_thread_fd_unlock(fd, FD_READ); _FD_UNLOCK(fd, FD_READ);
} else { } else {
ret = NULL; ret = NULL;
} }
@ -144,9 +144,9 @@ ttyname_r(int fd, char *buf, size_t len)
{ {
char *ret; char *ret;
if (_thread_fd_lock(fd, FD_READ, NULL, __FILE__, __LINE__) == 0) { if (_FD_LOCK(fd, FD_READ, NULL) == 0) {
ret = __ttyname_r_basic(fd, buf, len); ret = __ttyname_r_basic(fd, buf, len);
_thread_fd_unlock(fd, FD_READ); _FD_UNLOCK(fd, FD_READ);
} else { } else {
ret = NULL; ret = NULL;
} }