summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2016-02-23 09:37:59 -0500
committerKeith Bostic <keith@wiredtiger.com>2016-02-23 09:37:59 -0500
commitf90fb74abfd080de37ea92e6091d356d37cf3d25 (patch)
treeaef6b771adf5146b63558c97fdd110204165c853 /examples
parente5a56007153127bc04a680ffff1d6d98e563c6e2 (diff)
downloadmongo-f90fb74abfd080de37ea92e6091d356d37cf3d25.tar.gz
WT-2107: Add example code including an event handler
Review, minor wording and style cleanup.
Diffstat (limited to 'examples')
-rw-r--r--examples/c/ex_event_handler.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/c/ex_event_handler.c b/examples/c/ex_event_handler.c
index 1e277cab00c..fae61092687 100644
--- a/examples/c/ex_event_handler.c
+++ b/examples/c/ex_event_handler.c
@@ -42,9 +42,8 @@ int handle_wiredtiger_error(
int handle_wiredtiger_message(WT_EVENT_HANDLER *, WT_SESSION *, const char *);
/*! [Function event_handler] */
-
/*
- * Setup our own event handler structure to allow us to pass context through
+ * Create our own event handler structure to allow us to pass context through
* to event handler callbacks. For this to work the WiredTiger event handler
* must appear first in our custom event handler structure.
*/
@@ -82,8 +81,9 @@ int
handle_wiredtiger_message(
WT_EVENT_HANDLER *handler, WT_SESSION *session, const char *message)
{
+ /* Cast the handler back to our custom handler. */
printf("app id %s, thread context %p, message %s\n",
- ((CUSTOM_EVENT_HANDLER*)handler)->app_id, session, message);
+ ((CUSTOM_EVENT_HANDLER *)handler)->app_id, session, message);
return (0);
}
@@ -101,13 +101,13 @@ main(void)
event_handler.h.handle_error = handle_wiredtiger_error;
event_handler.h.handle_message = handle_wiredtiger_message;
- /* Setup a NULL to use the default handler. */
+ /* Set handlers to NULL to use the default handler. */
event_handler.h.handle_progress = NULL;
event_handler.h.handle_close = NULL;
event_handler.app_id = "example_event_handler";
ret = wiredtiger_open(home,
- (WT_EVENT_HANDLER*)&event_handler, "create", &conn);
+ (WT_EVENT_HANDLER *)&event_handler, "create", &conn);
/*! [Configure event_handler] */
/* Make an invalid API call, to ensure the event handler works. */