diff options
author | unknown <jani@a88-113-38-195.elisa-laajakaista.fi> | 2007-02-03 00:58:09 +0200 |
---|---|---|
committer | unknown <jani@a88-113-38-195.elisa-laajakaista.fi> | 2007-02-03 00:58:09 +0200 |
commit | 3f3d9093f9ce6152f5a018a946806c069837e219 (patch) | |
tree | 604c311840603ecece2a136bbdc86420a3ec0453 /plugin | |
parent | 13390debf6aa979ca31437d687eaa9ae2740ad2f (diff) | |
parent | 6e501e6548f15d3450ffb122ba1e683f40a4c917 (diff) | |
download | mariadb-git-3f3d9093f9ce6152f5a018a946806c069837e219.tar.gz |
Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1
BUILD/SETUP.sh:
Auto merged
client/mysql.cc:
Auto merged
configure.in:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
sql/filesort.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/opt_range.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_plugin.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
storage/archive/ha_archive.cc:
Auto merged
plugin/daemon_example/daemon_example.cc:
Merged with main 5.1
sql/mysqld.cc:
Merged with main 5.1
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/daemon_example/daemon_example.cc | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/plugin/daemon_example/daemon_example.cc b/plugin/daemon_example/daemon_example.cc index d4a8d843a0a..994c385796e 100644 --- a/plugin/daemon_example/daemon_example.cc +++ b/plugin/daemon_example/daemon_example.cc @@ -22,13 +22,15 @@ #include <my_dir.h> /* -#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8) + Disable __attribute__() on non-gcc compilers. +*/ +#if !defined(__attribute__) && !defined(__GNUC__) #define __attribute__(A) #endif -*/ -#define HEART_STRING_BUFFER 100 +#define HEART_STRING_BUFFER 100 + struct mysql_heartbeat_context { pthread_t heartbeat_thread; @@ -62,7 +64,6 @@ pthread_handler_t mysql_heartbeat(void *p) x++; } - DBUG_RETURN(0); } @@ -82,6 +83,7 @@ pthread_handler_t mysql_heartbeat(void *p) static int daemon_example_plugin_init(void *p) { + DBUG_ENTER("daemon_example_plugin_init"); struct mysql_heartbeat_context *con; pthread_attr_t attr; /* Thread attributes */ @@ -92,9 +94,11 @@ static int daemon_example_plugin_init(void *p) struct st_plugin_int *plugin= (struct st_plugin_int *)p; - con= (struct mysql_heartbeat_context *)my_malloc(sizeof(struct mysql_heartbeat_context), MYF(0)); + con= (struct mysql_heartbeat_context *) + my_malloc(sizeof(struct mysql_heartbeat_context), MYF(0)); - fn_format(heartbeat_filename, "mysql-heartbeat", "", ".log", MY_REPLACE_EXT | MY_UNPACK_FILENAME); + fn_format(heartbeat_filename, "mysql-heartbeat", "", ".log", + MY_REPLACE_EXT | MY_UNPACK_FILENAME); unlink(heartbeat_filename); con->heartbeat_file= my_open(heartbeat_filename, O_CREAT|O_RDWR, MYF(0)); @@ -118,12 +122,12 @@ static int daemon_example_plugin_init(void *p) /* now create the thread */ - if (pthread_create(&con->heartbeat_thread, &attr, mysql_heartbeat, (void *)con) != 0) + if (pthread_create(&con->heartbeat_thread, &attr, mysql_heartbeat, + (void *)con) != 0) { fprintf(stderr,"Could not create heartbeat thread!\n"); exit(0); } - plugin->data= (void *)con; DBUG_RETURN(0); @@ -142,12 +146,14 @@ static int daemon_example_plugin_init(void *p) 1 failure (cannot happen) */ + static int daemon_example_plugin_deinit(void *p) { DBUG_ENTER("daemon_example_plugin_deinit"); char buffer[HEART_STRING_BUFFER]; struct st_plugin_int *plugin= (struct st_plugin_int *)p; - struct mysql_heartbeat_context *con= (struct mysql_heartbeat_context *)plugin->data; + struct mysql_heartbeat_context *con= + (struct mysql_heartbeat_context *)plugin->data; time_t result= time(NULL); struct tm tm_tmp; @@ -165,12 +171,12 @@ static int daemon_example_plugin_deinit(void *p) my_write(con->heartbeat_file, buffer, strlen(buffer), MYF(0)); my_close(con->heartbeat_file, MYF(0)); - my_free((char *)con, MYF(0)); DBUG_RETURN(0); } + struct st_mysql_daemon daemon_example_plugin= { MYSQL_DAEMON_INTERFACE_VERSION }; |