res_stasis: Reduce RAII_VAR usage.

In addition to being a micro-optimization (RAII_VAR has overhead), this
change improves output of REF_DEBUG.  Unfortunately when RAII_VAR calls
ao2_cleanup it does so from a generated _dtor_varname function.  For
example this caused _dtor_app to release a reference instead of
__stasis_app_unregister.

Change-Id: I4ce67120583a446babf9adeec678b71d37fcd9e5
This commit is contained in:
Corey Farrell
2018-01-06 03:17:15 -05:00
parent 26e5edd043
commit 55a540272f
5 changed files with 323 additions and 172 deletions

View File

@@ -76,21 +76,26 @@ struct stasis_app_command *command_create(
void command_complete(struct stasis_app_command *command, int retval)
{
SCOPED_MUTEX(lock, &command->lock);
ast_mutex_lock(&command->lock);
command->is_done = 1;
command->retval = retval;
ast_cond_signal(&command->condition);
ast_mutex_unlock(&command->lock);
}
int command_join(struct stasis_app_command *command)
{
SCOPED_MUTEX(lock, &command->lock);
int ret;
ast_mutex_lock(&command->lock);
while (!command->is_done) {
ast_cond_wait(&command->condition, &command->lock);
}
return command->retval;
ret = command->retval;
ast_mutex_unlock(&command->lock);
return ret;
}
void command_invoke(struct stasis_app_command *command,