summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <miguel@light.local>2002-01-09 05:38:48 -0200
committerunknown <miguel@light.local>2002-01-09 05:38:48 -0200
commit87ec5559477643e2574872fca93a5b4898868de0 (patch)
tree0f9e1ac4b6b7ebc9cba483f4ac9ddf307c12d5c7 /sql
parent23a6f068854fefd2435d564f267776cef9ff0da1 (diff)
downloadmariadb-git-87ec5559477643e2574872fca93a5b4898868de0.tar.gz
Win32 Embedded Server Changes
libmysql/libmysql.def: For to have the same order of the 3.23.XX stuff libmysqld/lib_load.cc: For to have the file extension for VC++ libmysqld/lib_sql.cc: The VC++ compiler returns duplication define from net_serv.cc. If the same happens with Unix then those lines should be removed. VC++ file extension. sql/mysqld.cc: Changes for Win32 Embedded Server. sql/net_serv.cc: Sanja Fixes. sql/sql_cache.cc: To avoid the crash on Win9x
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc13
-rw-r--r--sql/net_serv.cc33
-rw-r--r--sql/sql_cache.cc5
3 files changed, 31 insertions, 20 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 8e9ff17387c..01fc23cdd38 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -380,10 +380,12 @@ enum db_type default_table_type=DB_TYPE_MYISAM;
#ifdef __WIN__
#undef getpid
#include <process.h>
+#if !defined(EMBEDDED_LIBRARY)
HANDLE hEventShutdown;
#include "nt_servc.h"
static NTService Service; // Service object for WinNT
#endif
+#endif
#ifdef OS2
pthread_cond_t eventShutdown;
@@ -609,6 +611,7 @@ void kill_mysql(void)
#endif
#if defined(__WIN__)
+#if !defined(EMBEDDED_LIBRARY)
{
if (!SetEvent(hEventShutdown))
{
@@ -621,6 +624,7 @@ void kill_mysql(void)
CloseHandle(hEvent);
*/
}
+#endif
#elif defined(OS2)
pthread_cond_signal( &eventShutdown); // post semaphore
#elif defined(HAVE_PTHREAD_KILL)
@@ -1558,8 +1562,9 @@ pthread_handler_decl(handle_shutdown,arg)
/* this call should create the message queue for this thread */
PeekMessage(&msg, NULL, 1, 65534,PM_NOREMOVE);
-
+#if !defined(EMBEDDED_LIBRARY)
if (WaitForSingleObject(hEventShutdown,INFINITE)==WAIT_OBJECT_0)
+#endif
kill_server(MYSQL_KILL_SIGNAL);
return 0;
}
@@ -1976,7 +1981,7 @@ The server will not act as a slave.");
}
}
(void) thr_setconcurrency(concurrency); // 10 by default
-#ifdef __WIN__ //IRENA
+#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) //IRENA
{
hEventShutdown=CreateEvent(0, FALSE, FALSE, "MySqlShutdown");
pthread_t hThread;
@@ -2084,6 +2089,7 @@ The server will not act as a slave.");
sql_print_error("After lock_thread_count");
#endif
#else
+#if !defined(EMBEDDED_LIBRARY)
if (Service.IsNT())
{
if(start_mode)
@@ -2103,6 +2109,7 @@ The server will not act as a slave.");
if(hEventShutdown) CloseHandle(hEventShutdown);
}
#endif
+#endif
#ifdef HAVE_OPENSSL
my_free((gptr)ssl_acceptor_fd,MYF(MY_ALLOW_ZERO_PTR));
#endif /* HAVE_OPENSSL */
@@ -2123,7 +2130,7 @@ The server will not act as a slave.");
}
-#ifdef __WIN__
+#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
/* ------------------------------------------------------------------------
main and thread entry function for Win32
(all this is needed only to run mysqld as a service on WinNT)
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 22d89386516..7a1d25e980d 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -62,12 +62,12 @@ ulong net_read_timeout= NET_READ_TIMEOUT;
ulong net_write_timeout= NET_WRITE_TIMEOUT;
#endif
-#ifdef __WIN__
-/* The following is because alarms doesn't work on windows. */
-#undef MYSQL_SERVER
+#if defined(__WIN__) || !defined(MYSQL_SERVER)
+ /* The following is because alarms doesn't work on windows. */
+#define NO_ALARM
#endif
-
-#ifdef MYSQL_SERVER
+
+#ifndef NO_ALARM
#include "my_pthread.h"
void sql_print_error(const char *format,...);
#define RETRY_COUNT mysqld_net_retry_count
@@ -79,7 +79,7 @@ extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received;
#define statistic_add(A,B,C)
#define DONT_USE_THR_ALARM
#define RETRY_COUNT 1
-#endif /* MYSQL_SERVER */
+#endif /* NO_ALARM */
#include "thr_alarm.h"
@@ -322,14 +322,14 @@ net_real_write(NET *net,const char *packet,ulong len)
long int length;
char *pos,*end;
thr_alarm_t alarmed;
-#if defined(MYSQL_SERVER)
+#ifndef NO_ALARM
ALARM alarm_buff;
#endif
uint retry_count=0;
my_bool net_blocking = vio_is_blocking(net->vio);
DBUG_ENTER("net_real_write");
-#ifdef USE_QUERY_CACHE
+#ifdef MYSQL_SERVER
if (net->query_cache_query != 0)
query_cache_insert(net, packet, len);
#endif
@@ -371,13 +371,13 @@ net_real_write(NET *net,const char *packet,ulong len)
#endif /* HAVE_COMPRESS */
/* DBUG_DUMP("net",packet,len); */
-#ifdef MYSQL_SERVER
+#ifndef NO_ALARM
thr_alarm_init(&alarmed);
if (net_blocking)
thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff);
#else
alarmed=0;
-#endif /* MYSQL_SERVER */
+#endif /* NO_ALARM */
pos=(char*) packet; end=pos+len;
while (pos != end)
@@ -459,8 +459,7 @@ net_real_write(NET *net,const char *packet,ulong len)
** Read something from server/clinet
*****************************************************************************/
-#ifdef MYSQL_SERVER
-
+#ifndef NO_ALARM
/*
Help function to clear the commuication buffer when we get a too
big packet
@@ -493,7 +492,7 @@ static void my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed)
statistic_add(bytes_received,length,&LOCK_bytes_received);
}
}
-#endif /* MYSQL_SERVER */
+#endif /* NO_ALARM */
/*
@@ -510,7 +509,7 @@ my_real_read(NET *net, ulong *complen)
uint i,retry_count=0;
ulong len=packet_error;
thr_alarm_t alarmed;
-#if defined(MYSQL_SERVER)
+#ifndef NO_ALARM
ALARM alarm_buff;
#endif
my_bool net_blocking=vio_is_blocking(net->vio);
@@ -520,10 +519,10 @@ my_real_read(NET *net, ulong *complen)
net->reading_or_writing=1;
thr_alarm_init(&alarmed);
-#ifdef MYSQL_SERVER
+#ifndef NO_ALARM
if (net_blocking)
thr_alarm(&alarmed,net->timeout,&alarm_buff);
-#endif /* MYSQL_SERVER */
+#endif /* NO_ALARM */
pos = net->buff + net->where_b; /* net->packet -4 */
for (i=0 ; i < 2 ; i++)
@@ -646,7 +645,7 @@ my_real_read(NET *net, ulong *complen)
{
if (net_realloc(net,helping))
{
-#ifdef MYSQL_SERVER
+#ifndef NO_ALARM
if (i == 1)
my_net_skip_rest(net, (uint32) len, &alarmed);
#endif
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 391fdc1abf4..759aeceea76 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1167,6 +1167,11 @@ void Query_cache::pack(ulong join_limit, uint iteration_limit)
void Query_cache::destroy()
{
+ if ( !initialized )
+ {
+ DBUG_PRINT("qcache", ("Query Cache not initialized"));
+ return;
+ }
DBUG_ENTER("Query_cache::destroy");
free_cache(1);
pthread_mutex_destroy(&structure_guard_mutex);