From 20f5c9533b4eb85f71ba951d3eabe4d25fcc5b0e Mon Sep 17 00:00:00 2001 From: jcarreira Date: Wed, 13 Sep 2017 12:28:56 -0700 Subject: [PATCH] Removing semaphore and locks that should not be needed anymore because we use a lock free queue --- src/client/TCPClient.cpp | 11 ----------- src/client/TCPClient.h | 4 ---- 2 files changed, 15 deletions(-) diff --git a/src/client/TCPClient.cpp b/src/client/TCPClient.cpp index 999f507e..c4f0e36d 100644 --- a/src/client/TCPClient.cpp +++ b/src/client/TCPClient.cpp @@ -44,7 +44,6 @@ TCPClient::~TCPClient() { if (sender_thread) { LOG("Terminating sender thread"); - queue_semaphore.signal(); // unblock sender thread sender_thread->join(); delete sender_thread; } @@ -602,8 +601,6 @@ ssize_t TCPClient::read_all(int sock, void* data, size_t len) { void TCPClient::process_send() { // Wait until there are messages to send while (1) { - queue_semaphore.wait(); - if (terminate_threads) { return; } @@ -644,9 +641,6 @@ void TCPClient::process_send() { #endif LOG("message pair sent by client"); - // Release the lock so that the other thread may add to the send queue - queue_lock.signal(); - // Add the builder to the queue if it is of the right type (a write) // And if not over capacity reuse_lock.wait(); @@ -693,11 +687,6 @@ BladeClient::ClientFuture TCPClient::enqueue_message( #ifdef PERF_LOG TimerFunction sem_time; -#endif - // Alert that the queue has been updated - queue_semaphore.signal(); - -#ifdef PERF_LOG LOG("TCPClient::enqueue_message semaphore signal time (us): ", sem_time.getUsElapsed()); #endif diff --git a/src/client/TCPClient.h b/src/client/TCPClient.h index ba82ee13..88c44990 100644 --- a/src/client/TCPClient.h +++ b/src/client/TCPClient.h @@ -147,12 +147,8 @@ class TCPClient : public BladeClient { /** Lock on the txn_map. */ cirrus::SpinLock map_lock; - /** Lock on the send_queue. */ - cirrus::SpinLock queue_lock; /** Lock on the reuse_queue. */ cirrus::SpinLock reuse_lock; - /** Semaphore for the send_queue. */ - cirrus::PosixSemaphore queue_semaphore; /** Thread that runs the receiving loop. */ std::thread* receiver_thread = nullptr; /** Thread that runs the sending loop. */