summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorunknown <thek@adventure.(none)>2007-10-01 12:44:29 +0200
committerunknown <thek@adventure.(none)>2007-10-01 12:44:29 +0200
commit319c6ef199118a8cf5431381c7d80551ec5f05c2 (patch)
tree51acc090b3821aa94fa62d3c079ad7f02ccee14d /sql/sql_cache.cc
parent0d6ec6cdc8c353af7b373df59264e7283e22edc5 (diff)
downloadmariadb-git-319c6ef199118a8cf5431381c7d80551ec5f05c2.tar.gz
Bug #30768 query cache patch for bug #21074 crashes on windows
"pthread_mutex_trylock" isn't implemented correctly for the Windows platform. This temporary patch reverts the patch for bug#21074 for Windows until pthread_mutex_trylock is properly implemented. sql/sql_cache.cc: Added code branch for the Windows platform to avoid a faulty pthread_mutex_trylock implementation.
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 9a29350880e..8c868971911 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1032,12 +1032,14 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
Query_cache_block_table *block_table, *block_table_end;
ulong tot_length;
Query_cache_query_flags flags;
+#ifndef __WIN__
const uint spin_treshold= 50000;
const double lock_time_treshold= 0.1; /* Time in seconds */
uint spin_count= 0;
int lock_status= 0;
ulong new_time= 0;
ulong stop_time= 0;
+#endif
DBUG_ENTER("Query_cache::send_result_to_client");
@@ -1085,6 +1087,9 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
}
}
+#ifdef __WIN__
+ STRUCT_LOCK(&structure_guard_mutex);
+#else
stop_time= my_clock()+(ulong)lock_time_treshold*CLOCKS_PER_SEC;
while ((lock_status= pthread_mutex_trylock(&structure_guard_mutex)) == EBUSY
&& spin_count < spin_treshold
@@ -1107,6 +1112,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
thd->lex->safe_to_cache_query= FALSE;
goto err;
}
+#endif
if (query_cache_size == 0 || flush_in_progress)
{