* Fixed various valgrind warnings.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1189 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2010-11-10 11:40:28 +00:00
parent 649248c909
commit 7e554e8b1b
4 changed files with 5 additions and 5 deletions
+2 -3
View File
@@ -61,7 +61,7 @@ public:
static const unsigned int max_size = 32;
thread_queue_hack() { std::memset(m_queue, 0, sizeof(thread_queue_hack)); }
thread_queue_hack() { std::memset(this, 0, sizeof(thread_queue_hack)); }
void lock() { while (!__sync_bool_compare_and_swap(&m_lock, 0, 1)) usleep(0); }
void unlock() { __sync_bool_compare_and_swap(&m_lock, 1, 0); }
@@ -94,8 +94,7 @@ public:
}
void clear_and_unlock() {
std::memset(m_queue, 0, sizeof(value_type) * (max_size + 1));
m_lock = 0;
std::memset(this, 0, sizeof(thread_queue_hack));
__sync_synchronize();
}