mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
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:
@@ -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,
|
||||
|
Reference in New Issue
Block a user