diff options
author | Mark Michelson <mmichelson@digium.com> | 2012-11-16 04:33:53 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2012-11-16 04:33:53 +0000 |
commit | 12de4198b83cd30ae1f991ee3ea8e752b39898e0 (patch) | |
tree | 2d84a7a3e8888330d15c1105c0cc2f6e23f850d2 /tests/test_taskprocessor.c | |
parent | e8898ec8bab18c6c6cadc94f4b2c33a623f5a46f (diff) |
Add a shutdown callback to taskprocessor listeners.
This helps account for the fact that it is unknown just
how many references may exist for a given taskprocessor
listener, so simply unreffing it from the taskprocessor
shutdown function is not enough to convey the gravity
of the situation.
By putting in a shutdown callback, it now becomes clear
to the listener not to try to do any further operations
on the taskprocessor.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376381 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'tests/test_taskprocessor.c')
-rw-r--r-- | tests/test_taskprocessor.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_taskprocessor.c b/tests/test_taskprocessor.c index eebf3d0b3..424449dd9 100644 --- a/tests/test_taskprocessor.c +++ b/tests/test_taskprocessor.c @@ -103,6 +103,7 @@ struct test_listener_pvt { int num_pushed; int num_emptied; int num_was_empty; + int shutdown; }; static void *test_alloc(struct ast_taskprocessor_listener *listener) @@ -128,6 +129,12 @@ static void test_emptied(struct ast_taskprocessor_listener *listener) ++pvt->num_emptied; } +static void test_shutdown(struct ast_taskprocessor_listener *listener) +{ + struct test_listener_pvt *pvt = listener->private_data; + pvt->shutdown = 1; +} + static void test_destroy(void *private_data) { struct test_listener_pvt *pvt = private_data; @@ -138,6 +145,7 @@ static const struct ast_taskprocessor_listener_callbacks test_callbacks = { .alloc = test_alloc, .task_pushed = test_task_pushed, .emptied = test_emptied, + .shutdown = test_shutdown, .destroy = test_destroy, }; |