summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2014-05-28 15:14:14 +1000
committerAlex Gorrod <alexg@wiredtiger.com>2014-05-28 15:14:14 +1000
commitc904ad189f81d9cb87690eb92bb085322b41795c (patch)
tree617f0c1db22a87a16f9d509713ae5724fb5c564b
parentf5b84b5c5012ef23ac0db5ab7dc839996daa421d (diff)
downloadmongo-c904ad189f81d9cb87690eb92bb085322b41795c.tar.gz
Add an app_private field to the WT_ASYNC_OP handle.
-rw-r--r--bench/wtperf/wtperf.c10
-rw-r--r--lang/java/wiredtiger.i8
-rw-r--r--lang/python/wiredtiger.i6
-rw-r--r--src/include/wiredtiger.in13
4 files changed, 24 insertions, 13 deletions
diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c
index 1c7976bb91c..5411cade6c5 100644
--- a/bench/wtperf/wtperf.c
+++ b/bench/wtperf/wtperf.c
@@ -150,7 +150,7 @@ cb_asyncop(WT_ASYNC_CALLBACK *cb, WT_ASYNC_OP *op, int ret, uint32_t flags)
(void)flags;
type = op->get_type(op);
if (type != WT_AOP_COMPACT) {
- thread = (CONFIG_THREAD *)op->async_app_private;
+ thread = (CONFIG_THREAD *)op->app_private;
cfg = thread->cfg;
}
trk = NULL;
@@ -174,7 +174,7 @@ cb_asyncop(WT_ASYNC_CALLBACK *cb, WT_ASYNC_OP *op, int ret, uint32_t flags)
trk = &thread->update;
break;
case WT_AOP_COMPACT:
- tables = (uint32_t *)op->async_app_private;
+ tables = (uint32_t *)op->app_private;
ATOMIC_ADD(*tables, (uint32_t)-1);
break;
case WT_AOP_REMOVE:
@@ -337,7 +337,7 @@ retry: if ((ret = conn->async_new_op(
(void)usleep(10000);
goto retry;
}
- asyncop->async_app_private = thread;
+ asyncop->app_private = thread;
asyncop->set_key(asyncop, key_buf);
switch (*op) {
case WORKER_READ:
@@ -911,7 +911,7 @@ retry: if ((ret = conn->async_new_op(
(void)usleep(10000);
goto retry;
}
- asyncop->async_app_private = thread;
+ asyncop->app_private = thread;
sprintf(key_buf, "%0*" PRIu64, cfg->key_sz, op);
asyncop->set_key(asyncop, key_buf);
@@ -1288,7 +1288,7 @@ retry: if ((ret = cfg->conn->async_new_op(cfg->conn,
}
return (ret);
}
- asyncop->async_app_private = &tables;
+ asyncop->app_private = &tables;
if ((ret = asyncop->compact(asyncop)) != 0) {
lprintf(cfg, ret, 0, "Async compact failed.");
return (ret);
diff --git a/lang/java/wiredtiger.i b/lang/java/wiredtiger.i
index b3dc74eeaf3..9f44a0cd7d2 100644
--- a/lang/java/wiredtiger.i
+++ b/lang/java/wiredtiger.i
@@ -392,9 +392,9 @@ javaAsyncHandler(WT_ASYNC_CALLBACK *cb, WT_ASYNC_OP *asyncop, int opret,
WT_UNUSED(flags);
op = (WT_ASYNC_OP_IMPL *)asyncop;
session = O2S(op);
- jcb = (JAVA_CALLBACK *)asyncop->async_app_private;
+ jcb = (JAVA_CALLBACK *)asyncop->app_private;
conn_jcb = (JAVA_CALLBACK *)S2C(session)->lang_private;
- asyncop->async_app_private = NULL;
+ asyncop->app_private = NULL;
/*
* We rely on the fact that the async machinery uses a pool of
@@ -539,7 +539,7 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
%javamethodmodifiers java_init "protected";
int java_init(jobject jasyncop) {
JAVA_CALLBACK *jcb =
- (JAVA_CALLBACK *)$self->async_app_private;
+ (JAVA_CALLBACK *)$self->app_private;
jcb->jobj = JCALL1(NewGlobalRef, jcb->jnienv, jasyncop);
JCALL1(DeleteLocalRef, jcb->jnienv, jasyncop);
return (0);
@@ -1766,7 +1766,7 @@ err: if (ret != 0)
(*jenv)->GetJavaVM(jenv, &jcb->javavm);
jcb->jcallback = JCALL1(NewGlobalRef, jcb->jnienv, callbackObject);
JCALL1(DeleteLocalRef, jcb->jnienv, callbackObject);
- asyncop->async_app_private = jcb;
+ asyncop->app_private = jcb;
asyncop->c.flags |= WT_CURSTD_RAW;
err: if (ret != 0)
diff --git a/lang/python/wiredtiger.i b/lang/python/wiredtiger.i
index a07b699156e..011e6a959d2 100644
--- a/lang/python/wiredtiger.i
+++ b/lang/python/wiredtiger.i
@@ -110,7 +110,7 @@ from packing import pack, unpack
/* XXX Is there a way to avoid SWIG's numbering? */
pcb->pyasynccb = callback_obj5;
Py_XINCREF(pcb->pyasynccb);
- (*$1)->async_app_private = pcb;
+ (*$1)->app_private = pcb;
}
}
}
@@ -1033,8 +1033,8 @@ pythonAsyncCallback(WT_ASYNC_CALLBACK *cb, WT_ASYNC_OP *asyncop, int opret,
op = (WT_ASYNC_OP_IMPL *)asyncop;
session = O2S(op);
- pcb = (PY_CALLBACK *)asyncop->async_app_private;
- asyncop->async_app_private = NULL;
+ pcb = (PY_CALLBACK *)asyncop->app_private;
+ asyncop->app_private = NULL;
ret = 0;
if (pcb->pyasynccb == NULL)
diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in
index 03d7eaeecc5..69d4079541c 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -583,6 +583,18 @@ struct __wt_async_op {
*/
const char *value_format;
+ /*
+ * Don't expose app_private to non-C language bindings - they have
+ * their own way to attach data to an operation.
+ */
+#if !defined(SWIG)
+ /*!
+ * A location for applications to store information that will be
+ * available in the callback from an async operation.
+ */
+ void *app_private;
+#endif
+
/*!
* @name Data access
* @{
@@ -791,7 +803,6 @@ struct __wt_async_op {
* functions to manage them.
*/
#if !defined(SWIG) && !defined(DOXYGEN)
-#define async_app_private c.lang_private
WT_CURSOR c;
#endif
};