Implement compile time debug mode for thread locks.
This commit is contained in:
parent
3d853e107e
commit
86af3ff9b0
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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.
|
||||
*/
|
||||
#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.
|
||||
*/
|
||||
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
|
||||
_atomic_unlock_stub(long *lck)
|
||||
_spinlock_debug_stub(spinlock_t *lck, char *fname, int lineno)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
@ -50,11 +50,11 @@ isatty(fd)
|
||||
struct termios t;
|
||||
|
||||
#ifdef _THREAD_SAFE
|
||||
if (_thread_fd_lock(fd, FD_READ, NULL,__FILE__,__LINE__) == 0) {
|
||||
if (_FD_LOCK(fd, FD_READ, NULL) == 0) {
|
||||
#endif
|
||||
retval = (tcgetattr(fd, &t) != -1);
|
||||
#ifdef _THREAD_SAFE
|
||||
_thread_fd_unlock(fd, FD_READ);
|
||||
_FD_UNLOCK(fd, FD_READ);
|
||||
} else {
|
||||
retval = 0;
|
||||
}
|
||||
|
@ -59,9 +59,9 @@ ttyname(int fd)
|
||||
{
|
||||
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);
|
||||
_thread_fd_unlock(fd, FD_READ);
|
||||
_FD_UNLOCK(fd, FD_READ);
|
||||
} else {
|
||||
ret = NULL;
|
||||
}
|
||||
@ -144,9 +144,9 @@ ttyname_r(int fd, char *buf, size_t len)
|
||||
{
|
||||
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);
|
||||
_thread_fd_unlock(fd, FD_READ);
|
||||
_FD_UNLOCK(fd, FD_READ);
|
||||
} else {
|
||||
ret = NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user