diff options
author | unknown <konstantin@mysql.com> | 2006-04-19 21:12:24 +0400 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2006-04-19 21:12:24 +0400 |
commit | 222cd6e891ab569b0ae26e5b07dfa3e4efb23485 (patch) | |
tree | 3a919693817bb02c60969288c717da48637b57c7 /sql/set_var.h | |
parent | 24c005cf2b41bcec881162bc3ea6f73ef8958896 (diff) | |
parent | c5ed5c4b1cba6761a0f2d79d939893f028c2bd22 (diff) | |
download | mariadb-git-222cd6e891ab569b0ae26e5b07dfa3e4efb23485.tar.gz |
Merge mysql.com:/opt/local/work/tmp_merge
into mysql.com:/opt/local/work/mysql-5.1-merge
mysql-test/r/ps.result:
Auto merged
mysql-test/t/ps.test:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/set_var.cc:
Manual merge.
sql/set_var.h:
Manual merge.
sql/share/errmsg.txt:
Manual merge.
Diffstat (limited to 'sql/set_var.h')
-rw-r--r-- | sql/set_var.h | 57 |
1 files changed, 41 insertions, 16 deletions
diff --git a/sql/set_var.h b/sql/set_var.h index f62d6ce8d2a..8076f10bb0a 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -48,11 +48,7 @@ public: sys_after_update_func after_update; bool no_support_one_shot; - sys_var(const char *name_arg) - :name(name_arg), after_update(0) - , no_support_one_shot(1) - { add_sys_var(); } - sys_var(const char *name_arg,sys_after_update_func func) + sys_var(const char *name_arg,sys_after_update_func func= NULL) :name(name_arg), after_update(func) , no_support_one_shot(1) { add_sys_var(); } @@ -83,15 +79,35 @@ public: }; -class sys_var_long_ptr :public sys_var +/* + A base class for all variables that require its access to + be guarded with a mutex. +*/ + +class sys_var_global: public sys_var +{ +protected: + pthread_mutex_t *guard; +public: + sys_var_global(const char *name_arg, sys_after_update_func after_update_arg, + pthread_mutex_t *guard_arg) + :sys_var(name_arg, after_update_arg), guard(guard_arg) {} +}; + + +/* + A global-only ulong variable that requires its access to be + protected with a mutex. +*/ + +class sys_var_long_ptr_global: public sys_var_global { public: ulong *value; - sys_var_long_ptr(const char *name_arg, ulong *value_ptr) - :sys_var(name_arg),value(value_ptr) {} - sys_var_long_ptr(const char *name_arg, ulong *value_ptr, - sys_after_update_func func) - :sys_var(name_arg,func), value(value_ptr) {} + sys_var_long_ptr_global(const char *name_arg, ulong *value_ptr, + pthread_mutex_t *guard_arg, + sys_after_update_func after_update_arg= NULL) + :sys_var_global(name_arg, after_update_arg, guard_arg), value(value_ptr) {} bool check(THD *thd, set_var *var); bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); @@ -101,6 +117,18 @@ public: }; +/* + A global ulong variable that is protected by LOCK_global_system_variables +*/ + +class sys_var_long_ptr :public sys_var_long_ptr_global +{ +public: + sys_var_long_ptr(const char *name_arg, ulong *value_ptr, + sys_after_update_func after_update_arg= NULL); +}; + + class sys_var_ulonglong_ptr :public sys_var { public: @@ -179,7 +207,7 @@ class sys_var_const_str :public sys_var public: char *value; // Pointer to const value sys_var_const_str(const char *name_arg, const char *value_arg) - :sys_var(name_arg), value((char*) value_arg) + :sys_var(name_arg),value((char*) value_arg) {} bool check(THD *thd, set_var *var) { @@ -226,10 +254,7 @@ public: class sys_var_thd :public sys_var { public: - sys_var_thd(const char *name_arg) - :sys_var(name_arg) - {} - sys_var_thd(const char *name_arg, sys_after_update_func func) + sys_var_thd(const char *name_arg, sys_after_update_func func= NULL) :sys_var(name_arg,func) {} bool check_type(enum_var_type type) { return 0; } |