1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-12 15:14:12 +00:00

possibly get the pthread changes compiling for old versions of Linux

This commit is contained in:
Charles Kerr 2007-12-02 17:15:52 +00:00
parent b14449fe80
commit 5e88ab235b

View file

@ -39,6 +39,9 @@
#include <shlobj.h> /* for CSIDL_APPDATA, CSIDL_PROFILE */
#else
#define _XOPEN_SOURCE 500 /* needed for recursive locks. */
#ifndef __USE_UNIX98
#define __USE_UNIX98 /* some older Linuxes need it spelt out for them */
#endif
#include <pthread.h>
#endif
@ -249,18 +252,21 @@ tr_lockLock( tr_lock * l )
#endif
l->lockThread = currentThread;
++l->depth;
assert( l->depth >= 1 );
}
int
tr_lockHave( const tr_lock * l )
{
return ( l->depth > 0 )
&& ( l->lockThread == tr_getCurrentThread() );
&& ( tr_areThreadsEqual( l->lockThread, tr_getCurrentThread() ) );
}
void
tr_lockUnlock( tr_lock * l )
{
assert( l->depth > 0 );
assert( tr_areThreadsEqual( l->lockThread, tr_getCurrentThread() ));
assert( tr_lockHave( l ) );
#ifdef __BEOS__
@ -271,6 +277,7 @@ tr_lockUnlock( tr_lock * l )
pthread_mutex_unlock( &l->lock );
#endif
--l->depth;
assert( l->depth >= 0 );
}
/***