You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.7 KiB

26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
Fixed compiler warnings Fixed compile-pentium64 scripts Fixed wrong estimate of update_with_key_prefix in sql-bench Merge bk-internal.mysql.com:/home/bk/mysql-5.1 into mysql.com:/home/my/mysql-5.1 Fixed unsafe define of uint4korr() Fixed that --extern works with mysql-test-run.pl Small trivial cleanups This also fixes a bug in counting number of rows that are updated when we have many simultanous queries Move all connection handling and command exectuion main loop from sql_parse.cc to sql_connection.cc Split handle_one_connection() into reusable sub functions. Split create_new_thread() into reusable sub functions. Added thread_scheduler; Preliminary interface code for future thread_handling code. Use 'my_thread_id' for internal thread id's Make thr_alarm_kill() to depend on thread_id instead of thread Make thr_abort_locks_for_thread() depend on thread_id instead of thread In store_globals(), set my_thread_var->id to be thd->thread_id. Use my_thread_var->id as basis for my_thread_name() The above changes makes the connection we have between THD and threads more soft. Added a lot of DBUG_PRINT() and DBUG_ASSERT() functions Fixed compiler warnings Fixed core dumps when running with --debug Removed setting of signal masks (was never used) Made event code call pthread_exit() (portability fix) Fixed that event code doesn't call DBUG_xxx functions before my_thread_init() is called. Made handling of thread_id and thd->variables.pseudo_thread_id uniform. Removed one common 'not freed memory' warning from mysqltest Fixed a couple of usage of not initialized warnings (unlikely cases) Suppress compiler warnings from bdb and (for the moment) warnings from ndb
19 years ago
Fixed compiler warnings Fixed compile-pentium64 scripts Fixed wrong estimate of update_with_key_prefix in sql-bench Merge bk-internal.mysql.com:/home/bk/mysql-5.1 into mysql.com:/home/my/mysql-5.1 Fixed unsafe define of uint4korr() Fixed that --extern works with mysql-test-run.pl Small trivial cleanups This also fixes a bug in counting number of rows that are updated when we have many simultanous queries Move all connection handling and command exectuion main loop from sql_parse.cc to sql_connection.cc Split handle_one_connection() into reusable sub functions. Split create_new_thread() into reusable sub functions. Added thread_scheduler; Preliminary interface code for future thread_handling code. Use 'my_thread_id' for internal thread id's Make thr_alarm_kill() to depend on thread_id instead of thread Make thr_abort_locks_for_thread() depend on thread_id instead of thread In store_globals(), set my_thread_var->id to be thd->thread_id. Use my_thread_var->id as basis for my_thread_name() The above changes makes the connection we have between THD and threads more soft. Added a lot of DBUG_PRINT() and DBUG_ASSERT() functions Fixed compiler warnings Fixed core dumps when running with --debug Removed setting of signal masks (was never used) Made event code call pthread_exit() (portability fix) Fixed that event code doesn't call DBUG_xxx functions before my_thread_init() is called. Made handling of thread_id and thd->variables.pseudo_thread_id uniform. Removed one common 'not freed memory' warning from mysqltest Fixed a couple of usage of not initialized warnings (unlikely cases) Suppress compiler warnings from bdb and (for the moment) warnings from ndb
19 years ago
26 years ago
26 years ago
  1. /* Copyright (C) 2000 MySQL AB
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  12. /* Prototypes when using thr_alarm library functions */
  13. #ifndef _thr_alarm_h
  14. #define _thr_alarm_h
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #ifndef USE_ALARM_THREAD
  19. #define USE_ONE_SIGNAL_HAND /* One must call process_alarm */
  20. #endif
  21. #ifdef HAVE_rts_threads
  22. #undef USE_ONE_SIGNAL_HAND
  23. #define USE_ALARM_THREAD
  24. #define THR_SERVER_ALARM SIGUSR1
  25. #else
  26. #define THR_SERVER_ALARM SIGALRM
  27. #endif
  28. typedef struct st_alarm_info
  29. {
  30. ulong next_alarm_time;
  31. uint active_alarms;
  32. uint max_used_alarms;
  33. } ALARM_INFO;
  34. void thr_alarm_info(ALARM_INFO *info);
  35. #if defined(DONT_USE_THR_ALARM) || !defined(THREAD)
  36. #define USE_ALARM_THREAD
  37. #undef USE_ONE_SIGNAL_HAND
  38. typedef my_bool thr_alarm_t;
  39. typedef my_bool ALARM;
  40. #define thr_alarm_init(A) (*(A))=0
  41. #define thr_alarm_in_use(A) (*(A) != 0)
  42. #define thr_end_alarm(A)
  43. #define thr_alarm(A,B,C) ((*(A)=1)-1)
  44. /* The following should maybe be (*(A)) */
  45. #define thr_got_alarm(A) 0
  46. #define init_thr_alarm(A)
  47. #define thr_alarm_kill(A)
  48. #define resize_thr_alarm(N)
  49. #define end_thr_alarm(A)
  50. #else
  51. #if defined(__WIN__)
  52. typedef struct st_thr_alarm_entry
  53. {
  54. UINT_PTR crono;
  55. } thr_alarm_entry;
  56. #else /* System with posix threads */
  57. typedef int thr_alarm_entry;
  58. #define thr_got_alarm(thr_alarm) (**(thr_alarm))
  59. #endif /* __WIN__ */
  60. typedef thr_alarm_entry* thr_alarm_t;
  61. typedef struct st_alarm {
  62. ulong expire_time;
  63. thr_alarm_entry alarmed; /* set when alarm is due */
  64. pthread_t thread;
  65. my_thread_id thread_id;
  66. my_bool malloced;
  67. } ALARM;
  68. extern uint thr_client_alarm;
  69. extern pthread_t alarm_thread;
  70. #define thr_alarm_init(A) (*(A))=0
  71. #define thr_alarm_in_use(A) (*(A)!= 0)
  72. void init_thr_alarm(uint max_alarm);
  73. void resize_thr_alarm(uint max_alarms);
  74. my_bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
  75. void thr_alarm_kill(my_thread_id thread_id);
  76. void thr_end_alarm(thr_alarm_t *alarmed);
  77. void end_thr_alarm(my_bool free_structures);
  78. sig_handler process_alarm(int);
  79. #ifndef thr_got_alarm
  80. my_bool thr_got_alarm(thr_alarm_t *alrm);
  81. #endif
  82. #endif /* DONT_USE_THR_ALARM */
  83. #ifdef __cplusplus
  84. }
  85. #endif /* __cplusplus */
  86. #endif /* _thr_alarm_h */