summaryrefslogtreecommitdiff
path: root/sql/my_apc.h
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2012-06-28 13:58:37 +0400
committerSergey Petrunya <psergey@askmonty.org>2012-06-28 13:58:37 +0400
commitc62c0c551684d063e51024579a4956f66048bbf5 (patch)
tree380b6d6d74e319732989a2cd8789482f6330e4f0 /sql/my_apc.h
parent66c62de1034e780144e6945b3a2150253e2a652c (diff)
downloadmariadb-git-c62c0c551684d063e51024579a4956f66048bbf5.tar.gz
MWL#182: Explain running statements: address review feedback
- Add Monty Program Ab copyright in new files - Change Apc_target::make_apc_call() to accept a C++-style functor (instead of C-style function + parameter)
Diffstat (limited to 'sql/my_apc.h')
-rw-r--r--sql/my_apc.h30
1 files changed, 22 insertions, 8 deletions
diff --git a/sql/my_apc.h b/sql/my_apc.h
index 450e07b92a4..3d9a2154af2 100644
--- a/sql/my_apc.h
+++ b/sql/my_apc.h
@@ -1,6 +1,18 @@
/*
- TODO: MP AB Copyright
-*/
+ Copyright (c) 2009, 2011, Monty Program Ab
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Interface
@@ -38,8 +50,12 @@ public:
void process_apc_requests();
- typedef void (*apc_func_t)(void *arg);
-
+ class Apc_call
+ {
+ public:
+ virtual void call_in_target_thread()= 0;
+ virtual ~Apc_call() {}
+ };
/*
Make an APC call: schedule it for execution and wait until the target
thread has executed it. This function must not be called from a thread
@@ -49,8 +65,7 @@ public:
@retval TRUE - Call wasnt made (either the target is in disabled state or
timeout occured)
*/
- bool make_apc_call(apc_func_t func, void *func_arg,
- int timeout_sec, bool *timed_out);
+ bool make_apc_call(Apc_call *call, int timeout_sec, bool *timed_out);
#ifndef DBUG_OFF
int n_calls_processed; /* Number of calls served by this target */
@@ -78,8 +93,7 @@ private:
class Call_request
{
public:
- apc_func_t func; /* Function to call */
- void *func_arg; /* Argument to pass it */
+ Apc_call *call; /* Functor to be called */
/* The caller will actually wait for "processed==TRUE" */
bool processed;