| 741 | */ |
| 742 | |
| 743 | void Query_cache::unlock(void) |
| 744 | { |
| 745 | DBUG_ENTER("Query_cache::unlock"); |
| 746 | mysql_mutex_lock(&structure_guard_mutex); |
| 747 | #ifndef DBUG_OFF |
| 748 | /* Thd may not be set in resize() at mysqld start */ |
| 749 | THD *thd= current_thd; |
| 750 | if (thd) |
| 751 | DBUG_ASSERT(m_cache_lock_thread_id == thd->thread_id); |
| 752 | #endif |
| 753 | DBUG_ASSERT(m_cache_lock_status == Query_cache::LOCKED || |
| 754 | m_cache_lock_status == Query_cache::LOCKED_NO_WAIT); |
| 755 | m_cache_lock_status= Query_cache::UNLOCKED; |
| 756 | DBUG_PRINT("Query_cache",("Sending signal")); |
| 757 | mysql_cond_signal(&COND_cache_status_changed); |
| 758 | DBUG_ASSERT(m_requests_in_progress > 0); |
| 759 | m_requests_in_progress--; |
| 760 | if (m_requests_in_progress == 0 && m_cache_status == DISABLE_REQUEST) |
| 761 | { |
| 762 | /* No clients => just free query cache */ |
| 763 | free_cache(); |
| 764 | m_cache_status= DISABLED; |
| 765 | } |
| 766 | mysql_mutex_unlock(&structure_guard_mutex); |
| 767 | DBUG_VOID_RETURN; |
| 768 | } |
| 769 | |
| 770 | |
| 771 | /** |
no test coverage detected