diff options
Diffstat (limited to 'tpool/tpool_structs.h')
-rw-r--r-- | tpool/tpool_structs.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tpool/tpool_structs.h b/tpool/tpool_structs.h index 099ae5c7..ff3228c9 100644 --- a/tpool/tpool_structs.h +++ b/tpool/tpool_structs.h @@ -155,12 +155,11 @@ public: { mysql_mutex_lock(&m_mtx); assert(!is_full()); + const bool was_empty= is_empty(); // put element to the logical end of the array m_cache[--m_pos] = ele; - /* Notify waiters when the cache becomes - not empty, or when it becomes full */ - if (m_pos == 1 || (m_waiters && is_full())) + if (was_empty || (is_full() && m_waiters)) pthread_cond_broadcast(&m_cv); mysql_mutex_unlock(&m_mtx); } |