Some scheduler API cleanup and improvements.

Previously, I had added the ast_sched_thread stuff that was a generic scheduler
thread implementation.  However, if you used it, it required using different
functions for modifying scheduler contents.  This patch reworks how this is
done and just allows you to optionally start a thread on the original scheduler
context structure that has always been there.  This makes it trivial to switch
to the generic scheduler thread implementation without having to touch any of
the other code that adds or removes scheduler entries.

In passing, I made some naming tweaks to add ast_ prefixes where they were not
there before.

Review: https://reviewboard.asterisk.org/r/1007/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@299091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2010-12-20 17:15:54 +00:00
parent cf655aa1c9
commit cc0b7e7df5
28 changed files with 328 additions and 405 deletions

View File

@@ -46,7 +46,7 @@ static int sched_cb(const void *data)
AST_TEST_DEFINE(sched_test_order)
{
struct sched_context *con;
struct ast_sched_context *con;
enum ast_test_result_state res = AST_TEST_FAIL;
int id1, id2, id3, wait;
@@ -63,7 +63,7 @@ AST_TEST_DEFINE(sched_test_order)
break;
}
if (!(con = sched_context_create())) {
if (!(con = ast_sched_context_create())) {
ast_test_status_update(test,
"Test failed - could not create scheduler context\n");
return AST_TEST_FAIL;
@@ -154,14 +154,14 @@ AST_TEST_DEFINE(sched_test_order)
res = AST_TEST_PASS;
return_cleanup:
sched_context_destroy(con);
ast_sched_context_destroy(con);
return res;
}
static char *handle_cli_sched_bench(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct sched_context *con;
struct ast_sched_context *con;
struct timeval start;
unsigned int num, i;
int *sched_ids = NULL;
@@ -185,7 +185,7 @@ static char *handle_cli_sched_bench(struct ast_cli_entry *e, int cmd, struct ast
return CLI_SHOWUSAGE;
}
if (!(con = sched_context_create())) {
if (!(con = ast_sched_context_create())) {
ast_cli(a->fd, "Test failed - could not create scheduler context\n");
return CLI_FAILURE;
}
@@ -225,7 +225,7 @@ static char *handle_cli_sched_bench(struct ast_cli_entry *e, int cmd, struct ast
ast_cli(a->fd, "Test complete - %" PRIi64 " us\n", ast_tvdiff_us(ast_tvnow(), start));
return_cleanup:
sched_context_destroy(con);
ast_sched_context_destroy(con);
if (sched_ids) {
ast_free(sched_ids);
}