1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-12 23:23:54 +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 */ #include <shlobj.h> /* for CSIDL_APPDATA, CSIDL_PROFILE */
#else #else
#define _XOPEN_SOURCE 500 /* needed for recursive locks. */ #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> #include <pthread.h>
#endif #endif
@ -249,18 +252,21 @@ tr_lockLock( tr_lock * l )
#endif #endif
l->lockThread = currentThread; l->lockThread = currentThread;
++l->depth; ++l->depth;
assert( l->depth >= 1 );
} }
int int
tr_lockHave( const tr_lock * l ) tr_lockHave( const tr_lock * l )
{ {
return ( l->depth > 0 ) return ( l->depth > 0 )
&& ( l->lockThread == tr_getCurrentThread() ); && ( tr_areThreadsEqual( l->lockThread, tr_getCurrentThread() ) );
} }
void void
tr_lockUnlock( tr_lock * l ) tr_lockUnlock( tr_lock * l )
{ {
assert( l->depth > 0 );
assert( tr_areThreadsEqual( l->lockThread, tr_getCurrentThread() ));
assert( tr_lockHave( l ) ); assert( tr_lockHave( l ) );
#ifdef __BEOS__ #ifdef __BEOS__
@ -271,6 +277,7 @@ tr_lockUnlock( tr_lock * l )
pthread_mutex_unlock( &l->lock ); pthread_mutex_unlock( &l->lock );
#endif #endif
--l->depth; --l->depth;
assert( l->depth >= 0 );
} }
/*** /***