mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 14:45:12 -04:00
- implemented a visualisation for currently handled chunks, availability maps, and transfer info
- implemented transfer protocol for chunk availability maps between peers (not enabled yet though) - suppressed rsiface directory from retroshare-gui - moved notifyqt.{h,cpp} to gui/ next moves: - send availability maps to clients; - connect turtle search to unfinished files; - test multisource download with unfinished files. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1939 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
1a86871556
commit
f4a2eaecce
19 changed files with 622 additions and 747 deletions
|
@ -32,18 +32,57 @@
|
|||
|
||||
/* RsIface Thread Wrappers */
|
||||
|
||||
#undef RSTHREAD_SELF_LOCKING_GUARD
|
||||
|
||||
class RsMutex
|
||||
{
|
||||
public:
|
||||
|
||||
RsMutex() { pthread_mutex_init(&realMutex, NULL); }
|
||||
~RsMutex() { pthread_mutex_destroy(&realMutex); }
|
||||
void lock() { pthread_mutex_lock(&realMutex); }
|
||||
void unlock() { pthread_mutex_unlock(&realMutex); }
|
||||
bool trylock() { return (0 == pthread_mutex_trylock(&realMutex)); }
|
||||
RsMutex()
|
||||
{
|
||||
pthread_mutex_init(&realMutex, NULL);
|
||||
#ifdef RSTHREAD_SELF_LOCKING_GUARD
|
||||
_thread_id = 0 ;
|
||||
#endif
|
||||
}
|
||||
~RsMutex()
|
||||
{
|
||||
pthread_mutex_destroy(&realMutex);
|
||||
}
|
||||
|
||||
void lock()
|
||||
{
|
||||
#ifdef RSTHREAD_SELF_LOCKING_GUARD
|
||||
if(!trylock())
|
||||
if(!pthread_equal(_thread_id,pthread_self()))
|
||||
#endif
|
||||
pthread_mutex_lock(&realMutex);
|
||||
|
||||
#ifdef RSTHREAD_SELF_LOCKING_GUARD
|
||||
_thread_id = pthread_self() ;
|
||||
++_cnt ;
|
||||
#endif
|
||||
}
|
||||
void unlock()
|
||||
{
|
||||
#ifdef RSTHREAD_SELF_LOCKING_GUARD
|
||||
if(--_cnt == 0)
|
||||
{
|
||||
#endif
|
||||
pthread_mutex_unlock(&realMutex);
|
||||
#ifdef RSTHREAD_SELF_LOCKING_GUARD
|
||||
_thread_id = 0 ;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
bool trylock() { return (0 == pthread_mutex_trylock(&realMutex)); }
|
||||
|
||||
private:
|
||||
pthread_mutex_t realMutex;
|
||||
pthread_mutex_t realMutex;
|
||||
#ifdef RSTHREAD_SELF_LOCKING_GUARD
|
||||
pthread_t _thread_id ;
|
||||
uint32_t _cnt ;
|
||||
#endif
|
||||
};
|
||||
|
||||
class RsStackMutex
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue