summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2000-08-22 00:18:32 +0300
committerunknown <monty@donna.mysql.com>2000-08-22 00:18:32 +0300
commit90104181f979b04de0a2889c2299c0add02d949c (patch)
treec129c5ccdb3df8c87c28c6a51baac6e208294313 /mysys
parent90bc6094eed4bde988bad568ac48bd686a127639 (diff)
downloadmariadb-git-90104181f979b04de0a2889c2299c0add02d949c.tar.gz
FLUSH TABLE table_list
Fixes for RENAME TABLE Portability fixes Docs/manual.texi: FLUSH TABLES table_list client/mysql.cc: Ia64 port client/mysqladmin.c: Ia64 port client/mysqldump.c: Ia64 port client/mysqlimport.c: Ia64 port client/mysqlshow.c: Ia64 port client/readline.cc: Ia64 port configure.in: Ia64 port include/config-win.h: Ia64 port include/thr_alarm.h: Ia64 port myisam/myisamdef.h: Ia64 port myisammrg/myrg_rkey.c: Ia64 port mysys/thr_alarm.c: Easier compile of non threaded client mysys/thr_lock.c: Easier compile of non threaded client mysys/thr_mutex.c: Easier compile of non threaded client sql-bench/crash-me.sh: Added test for RENAME + some ANSI SQL99 group functions sql-bench/limits/mysql.cfg: New run sql-bench/server-cfg.sh: Fix sql-bench/test-insert.sh: Fix sql/field.cc: Port to Ia64 sql/ha_berkeley.cc: Port to Ia64 sql/ha_myisam.cc: cleanup sql/handler.cc: Port to Ia64 sql/hostname.cc: Port to Ia64 sql/item.cc: Port to Ia64 sql/item_create.cc: Port to Ia64 sql/item_func.cc: Port to Ia64 sql/item_strfunc.cc: Port to Ia64 sql/item_timefunc.cc: Port to Ia64 sql/lock.cc: Fix for RENAME sql/log.cc: Port to Ia64 sql/log_event.h: Port to Ia64 sql/mini_client.cc: Port to Ia64 sql/mysql_priv.h: Port to Ia64 sql/mysqlbinlog.cc: Port to Ia64 sql/mysqld.cc: FLUSH TABLES table_list sql/net_pkg.cc: Port to Ia64 sql/procedure.h: Port to Ia64 sql/share/swedish/errmsg.OLD: FLUSH TABLES table_list sql/slave.cc: Port to Ia64 sql/sql_acl.cc: Port to Ia64 sql/sql_analyse.cc: Port to Ia64 sql/sql_analyse.h: Port to Ia64 sql/sql_base.cc: FLUSH TABLES table_list sql/sql_class.cc: Port to Ia64 sql/sql_class.h: Port to Ia64 sql/sql_parse.cc: Port to Ia64 sql/sql_rename.cc: Fix of RENAME sql/sql_show.cc: Port to Ia64 sql/sql_string.cc: Port to Ia64 sql/sql_string.h: Port to Ia64 sql/sql_table.cc: Fix of RENAME sql/sql_udf.cc: Port to Ia64 sql/sql_yacc.yy: FLUSH TABLES table_list sql/table.cc: Port to Ia64 sql/thr_malloc.cc: Port to Ia64 sql/time.cc: Port to Ia64 sql/unireg.cc: Port to Ia64
Diffstat (limited to 'mysys')
-rw-r--r--mysys/thr_alarm.c305
-rw-r--r--mysys/thr_lock.c23
-rw-r--r--mysys/thr_mutex.c4
3 files changed, 174 insertions, 158 deletions
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index de8d3718c11..2397e315eff 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -16,6 +16,8 @@
MA 02111-1307, USA */
#include <global.h>
+
+#if defined(THREAD) && !defined(DONT_USE_THR_ALARM)
#include <errno.h>
#include <my_pthread.h>
#include <signal.h>
@@ -24,8 +26,6 @@
#include <queues.h>
#include "thr_alarm.h"
-#ifdef THREAD
-
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> /* AIX needs this for fd_set */
#endif
@@ -38,7 +38,6 @@ static my_bool alarm_aborted=1;
my_bool thr_alarm_inited=0;
#if !defined(__WIN__) && !defined(__OS2__)
-#ifndef DONT_USE_THR_ALARM /* thr_alarm disabled */
static pthread_mutex_t LOCK_alarm;
static sigset_t full_signal_set;
@@ -455,10 +454,150 @@ static void *alarm_handler(void *arg __attribute__((unused)))
pthread_exit(0);
return 0; /* Impossible */
}
-#endif
+#endif /* USE_ALARM_THREAD */
+
+/*****************************************************************************
+** thr_alarm for OS/2
+*****************************************************************************/
+
+#elif defined(__OS2__)
+
+#define INCL_BASE
+#define INCL_NOPMAPI
+#include <os2.h>
+
+bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
+{
+ APIRET rc;
+ if (alarm_aborted)
+ {
+ alrm->crono=0;
+ alrm->event=0;
+ return 1;
+ }
+ if (!(rc = DosCreateEventSem(NULL,(HEV *)&alrm->event,DC_SEM_SHARED,FALSE)))
+ {
+ printf("Error creating event semaphore! [%d] \n",rc);
+ alrm->crono=0;
+ alrm->event=0;
+ return 1;
+ }
+ if (!(rc = DosAsyncTimer((long) sec*1000L, (HSEM) alrm->event,(HTIMER *) &alrm->crono))) {
+ printf("Error starting async timer! [%d] \n",rc);
+ DosCloseEventSem((HEV) alrm->event);
+ alrm->crono=0;
+ alrm->event=0;
+ return 1;
+ } /* endif */
+
+ return 1;
+}
+
+
+bool thr_got_alarm(thr_alarm_t *alrm)
+{
+ APIRET rc;
+
+ if (alrm->crono)
+ {
+ rc = DosWaitEventSem((HEV) alrm->event, SEM_IMMEDIATE_RETURN);
+ if (rc == 0) {
+ DosCloseEventSem((HEV) alrm->event);
+ alrm->crono = 0;
+ alrm->event = 0;
+ } /* endif */
+ }
+ return !alrm->crono || alarm_aborted;
+}
+
+
+void thr_end_alarm(thr_alarm_t *alrm)
+{
+ if (alrm->crono)
+ {
+ DosStopTimer((HTIMER) alrm->crono);
+ DosCloseEventSem((HEV) alrm->event);
+ alrm->crono = 0;
+ alrm->event = 0;
+ }
+}
+
+void end_thr_alarm(void)
+{
+ DBUG_ENTER("end_thr_alarm");
+ alarm_aborted=1; /* No more alarms */
+ DBUG_VOID_RETURN;
+}
+
+void init_thr_alarm(uint max_alarm)
+{
+ DBUG_ENTER("init_thr_alarm");
+ alarm_aborted=0; /* Yes, Gimmie alarms */
+ DBUG_VOID_RETURN;
+}
+
+/*****************************************************************************
+** thr_alarm for win95
+*****************************************************************************/
+
+#else /* __WIN__ */
+
+bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
+{
+ if (alarm_aborted)
+ {
+ alrm->crono=0;
+ return 1;
+ }
+ if (!(alrm->crono=SetTimer((HWND) NULL,0, sec*1000,(TIMERPROC) NULL)))
+ return 1;
+ return 0;
+}
+
+
+bool thr_got_alarm(thr_alarm_t *alrm)
+{
+ MSG msg;
+ if (alrm->crono)
+ {
+ PeekMessage(&msg,NULL,WM_TIMER,WM_TIMER,PM_REMOVE) ;
+ if (msg.message == WM_TIMER || alarm_aborted)
+ {
+ KillTimer(NULL, alrm->crono);
+ alrm->crono = 0;
+ }
+ }
+ return !alrm->crono || alarm_aborted;
+}
+
+
+void thr_end_alarm(thr_alarm_t *alrm)
+{
+ if (alrm->crono)
+ {
+ KillTimer(NULL, alrm->crono);
+ alrm->crono = 0;
+ }
+}
+
+void end_thr_alarm(void)
+{
+ DBUG_ENTER("end_thr_alarm");
+ alarm_aborted=1; /* No more alarms */
+ DBUG_VOID_RETURN;
+}
+
+#endif /* __WIN__ */
+
+#endif /* THREAD */
+
+/****************************************************************************
+** Handling of MAIN
+***************************************************************************/
#ifdef MAIN
+#if defined(THREAD) && !defined(DONT_USE_THR_ALARM)
static pthread_cond_t COND_thread_count;
static pthread_mutex_t LOCK_thread_count;
@@ -468,7 +607,7 @@ static uint thread_count;
typedef int * fd_set_ptr;
#else
typedef fd_set * fd_set_ptr;
-#endif
+#endif /* HPUX */
static void *test_thread(void *arg)
{
@@ -567,8 +706,7 @@ static sig_handler print_signal_warning(int sig)
if (sig == SIGALRM)
alarm(2); /* reschedule alarm */
}
-#endif
-
+#endif /* USE_ONE_SIGNAL_HAND */
static void *signal_hand(void *arg __attribute__((unused)))
@@ -718,157 +856,18 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
printf("Test succeeded\n");
return 0;
}
-#endif /* MAIN */
-#else /* DONT_USE_THR_ALARM */
+#else /* THREAD */
-#ifdef MAIN
int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
{
+#ifndef THREAD
+ printf("thr_alarm disabled because we are not using threads\n");
+#else
printf("thr_alarm disabled with DONT_USE_THR_ALARM\n");
- exit(1);
-}
-#endif
#endif
-
-/*****************************************************************************
-** thr_alarm for OS/2
-*****************************************************************************/
-
-#elif defined(__OS2__)
-
-#define INCL_BASE
-#define INCL_NOPMAPI
-#include <os2.h>
-
-bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
-{
- APIRET rc;
- if (alarm_aborted)
- {
- alrm->crono=0;
- alrm->event=0;
- return 1;
- }
- if (!(rc = DosCreateEventSem(NULL,(HEV *)&alrm->event,DC_SEM_SHARED,FALSE)))
- {
- printf("Error creating event semaphore! [%d] \n",rc);
- alrm->crono=0;
- alrm->event=0;
- return 1;
- }
- if (!(rc = DosAsyncTimer((long) sec*1000L, (HSEM) alrm->event,(HTIMER *) &alrm->crono))) {
- printf("Error starting async timer! [%d] \n",rc);
- DosCloseEventSem((HEV) alrm->event);
- alrm->crono=0;
- alrm->event=0;
- return 1;
- } /* endif */
-
- return 1;
-}
-
-
-bool thr_got_alarm(thr_alarm_t *alrm)
-{
- APIRET rc;
-
- if (alrm->crono)
- {
- rc = DosWaitEventSem((HEV) alrm->event, SEM_IMMEDIATE_RETURN);
- if (rc == 0) {
- DosCloseEventSem((HEV) alrm->event);
- alrm->crono = 0;
- alrm->event = 0;
- } /* endif */
- }
- return !alrm->crono || alarm_aborted;
-}
-
-
-void thr_end_alarm(thr_alarm_t *alrm)
-{
- if (alrm->crono)
- {
- DosStopTimer((HTIMER) alrm->crono);
- DosCloseEventSem((HEV) alrm->event);
- alrm->crono = 0;
- alrm->event = 0;
- }
-}
-
-void end_thr_alarm(void)
-{
- DBUG_ENTER("end_thr_alarm");
- alarm_aborted=1; /* No more alarms */
- DBUG_VOID_RETURN;
-}
-
-void init_thr_alarm(uint max_alarm)
-{
- DBUG_ENTER("init_thr_alarm");
- alarm_aborted=0; /* Yes, Gimmie alarms */
- DBUG_VOID_RETURN;
-}
-
-#ifdef MAIN
-void main()
-{
- printf("hello world\n");
-}
-#endif
-
-/*****************************************************************************
-** thr_alarm for win95
-*****************************************************************************/
-
-#else /* __WIN__ */
-
-bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
-{
- if (alarm_aborted)
- {
- alrm->crono=0;
- return 1;
- }
- if (!(alrm->crono=SetTimer((HWND) NULL,0, sec*1000,(TIMERPROC) NULL)))
- return 1;
- return 0;
-}
-
-
-bool thr_got_alarm(thr_alarm_t *alrm)
-{
- MSG msg;
- if (alrm->crono)
- {
- PeekMessage(&msg,NULL,WM_TIMER,WM_TIMER,PM_REMOVE) ;
- if (msg.message == WM_TIMER || alarm_aborted)
- {
- KillTimer(NULL, alrm->crono);
- alrm->crono = 0;
- }
- }
- return !alrm->crono || alarm_aborted;
-}
-
-
-void thr_end_alarm(thr_alarm_t *alrm)
-{
- if (alrm->crono)
- {
- KillTimer(NULL, alrm->crono);
- alrm->crono = 0;
- }
-}
-
-void end_thr_alarm(void)
-{
- DBUG_ENTER("end_thr_alarm");
- alarm_aborted=1; /* No more alarms */
- DBUG_VOID_RETURN;
+ exit(1);
}
-#endif /* __WIN__ */
-
-#endif
+#endif /* THREAD */
+#endif /* MAIN */
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 5c0803c6402..df360447e69 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -76,13 +76,14 @@ multiple read locks.
#endif
#include "mysys_priv.h"
+
+#ifdef THREAD
#include "thr_lock.h"
#include <m_string.h>
#include <errno.h>
my_bool thr_lock_inited=0;
-#ifdef THREAD
/* The following constants are only for debug output */
#define MAX_THREADS 100
@@ -1063,8 +1064,16 @@ void thr_print_locks(void)
pthread_mutex_unlock(&THR_LOCK_lock);
}
+#endif /* THREAD */
+
+/*****************************************************************************
+** Test of thread locks
+****************************************************************************/
+
#ifdef MAIN
+#ifdef THREAD
+
struct st_test {
uint lock_nr;
enum thr_lock_type lock_type;
@@ -1283,6 +1292,14 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
printf("Test succeeded\n");
return 0;
}
-#endif
-#endif
+#else /* THREAD */
+
+int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
+{
+ printf("thr_lock disabled because we are not using threads\n");
+ exit(1);
+}
+
+#endif /* THREAD */
+#endif /* MAIN */
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index 7eea5be473b..9b9c7a8e407 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -37,7 +37,7 @@
#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT
#define pthread_mutex_init(a,b) my_pthread_mutex_init((a),(b))
#endif
-#endif
+#endif /* DO_NOT_REMOVE_THREAD_WRAPPERS */
int safe_mutex_init(safe_mutex_t *mp,
const pthread_mutexattr_t *attr __attribute__((unused)))
@@ -211,4 +211,4 @@ int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
return pthread_mutex_destroy(&mp->mutex);
}
-#endif /* SAFE_MUTEX */
+#endif /* THREAD && SAFE_MUTEX */