static void aopen_incusecnt()
{
- pthread_mutex_lock(&usecnt_lock);
+ ast_pthread_mutex_lock(&usecnt_lock);
usecnt++;
- pthread_mutex_unlock(&usecnt_lock);
+ ast_pthread_mutex_unlock(&usecnt_lock);
ast_update_use_count();
}
static void aopen_decusecnt()
{
- pthread_mutex_lock(&usecnt_lock);
+ ast_pthread_mutex_lock(&usecnt_lock);
usecnt++;
- pthread_mutex_unlock(&usecnt_lock);
+ ast_pthread_mutex_unlock(&usecnt_lock);
ast_update_use_count();
}
int usecount(void)
{
int res;
- pthread_mutex_lock(&usecnt_lock);
+ ast_pthread_mutex_lock(&usecnt_lock);
res = usecnt;
- pthread_mutex_unlock(&usecnt_lock);
+ ast_pthread_mutex_unlock(&usecnt_lock);
return res;
}
static void i4l_incusecnt()
{
- pthread_mutex_lock(&usecnt_lock);
+ ast_pthread_mutex_lock(&usecnt_lock);
usecnt++;
- pthread_mutex_unlock(&usecnt_lock);
+ ast_pthread_mutex_unlock(&usecnt_lock);
ast_update_use_count();
}
static void i4l_decusecnt()
{
- pthread_mutex_lock(&usecnt_lock);
+ ast_pthread_mutex_lock(&usecnt_lock);
usecnt++;
- pthread_mutex_unlock(&usecnt_lock);
+ ast_pthread_mutex_unlock(&usecnt_lock);
ast_update_use_count();
}
int usecount(void)
{
int res;
- pthread_mutex_lock(&usecnt_lock);
+ ast_pthread_mutex_lock(&usecnt_lock);
res = usecnt;
- pthread_mutex_unlock(&usecnt_lock);
+ ast_pthread_mutex_unlock(&usecnt_lock);
return res;
}
#include <asterisk/logger.h>
#include <asterisk/module.h>
#include <asterisk/translate.h>
+#include <asterisk/channel.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <pthread.h>
unload_module (void)
{
int res;
- pthread_mutex_lock (&localuser_lock);
+ ast_pthread_mutex_lock (&localuser_lock);
res = ast_unregister_translator (&lintoadpcm);
if (!res)
res = ast_unregister_translator (&adpcmtolin);
if (localusecnt)
res = -1;
- pthread_mutex_unlock (&localuser_lock);
+ ast_pthread_mutex_unlock (&localuser_lock);
return res;
}
#include <asterisk/translate.h>
#include <asterisk/module.h>
#include <asterisk/logger.h>
+#include <asterisk/channel.h>
#include <pthread.h>
#include <fcntl.h>
#include <stdlib.h>
int unload_module(void)
{
int res;
- pthread_mutex_lock(&localuser_lock);
+ ast_pthread_mutex_lock(&localuser_lock);
res = ast_unregister_translator(&lintogsm);
if (!res)
res = ast_unregister_translator(&gsmtolin);
if (localusecnt)
res = -1;
- pthread_mutex_unlock(&localuser_lock);
+ ast_pthread_mutex_unlock(&localuser_lock);
return res;
}
#include <asterisk/translate.h>
#include <asterisk/module.h>
#include <asterisk/logger.h>
+#include <asterisk/channel.h>
#include <pthread.h>
#include <fcntl.h>
#include <stdlib.h>
int unload_module(void)
{
int res;
- pthread_mutex_lock(&localuser_lock);
+ ast_pthread_mutex_lock(&localuser_lock);
res = ast_unregister_translator(&lintolpc10);
if (!res)
res = ast_unregister_translator(&lpc10tolin);
if (localusecnt)
res = -1;
- pthread_mutex_unlock(&localuser_lock);
+ ast_pthread_mutex_unlock(&localuser_lock);
return res;
}
and be sure it's a valid file. */
struct ast_filestream *tmp;
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
- if (pthread_mutex_lock(&g723_lock)) {
+ if (ast_pthread_mutex_lock(&g723_lock)) {
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
free(tmp);
return NULL;
tmp->orig.tv_usec = 0;
tmp->orig.tv_sec = 0;
glistcnt++;
- pthread_mutex_unlock(&g723_lock);
+ ast_pthread_mutex_unlock(&g723_lock);
ast_update_use_count();
}
return tmp;
and be sure it's a valid file. */
struct ast_filestream *tmp;
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
- if (pthread_mutex_lock(&g723_lock)) {
+ if (ast_pthread_mutex_lock(&g723_lock)) {
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
free(tmp);
return NULL;
tmp->orig.tv_usec = 0;
tmp->orig.tv_sec = 0;
glistcnt++;
- pthread_mutex_unlock(&g723_lock);
+ ast_pthread_mutex_unlock(&g723_lock);
ast_update_use_count();
} else
ast_log(LOG_WARNING, "Out of memory\n");
static void g723_close(struct ast_filestream *s)
{
struct ast_filestream *tmp, *tmpl = NULL;
- if (pthread_mutex_lock(&g723_lock)) {
+ if (ast_pthread_mutex_lock(&g723_lock)) {
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
return;
}
ast_sched_del(s->owner->sched, s->owner->streamid);
s->owner->streamid = -1;
}
- pthread_mutex_unlock(&g723_lock);
+ ast_pthread_mutex_unlock(&g723_lock);
ast_update_use_count();
if (!tmp)
ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
int unload_module()
{
struct ast_filestream *tmp, *tmpl;
- if (pthread_mutex_lock(&g723_lock)) {
+ if (ast_pthread_mutex_lock(&g723_lock)) {
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
return -1;
}
tmp = tmp->next;
free(tmpl);
}
- pthread_mutex_unlock(&g723_lock);
+ ast_pthread_mutex_unlock(&g723_lock);
return ast_format_unregister(name);
}
int usecount()
{
int res;
- if (pthread_mutex_lock(&g723_lock)) {
+ if (ast_pthread_mutex_lock(&g723_lock)) {
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
return -1;
}
res = glistcnt;
- pthread_mutex_unlock(&g723_lock);
+ ast_pthread_mutex_unlock(&g723_lock);
return res;
}
struct ast_filestream *tmp;
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
memset(tmp, 0, sizeof(struct ast_filestream));
- if (pthread_mutex_lock(&gsm_lock)) {
+ if (ast_pthread_mutex_lock(&gsm_lock)) {
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
free(tmp);
return NULL;
tmp->fr.mallocd = 0;
tmp->lasttimeout = -1;
glistcnt++;
- pthread_mutex_unlock(&gsm_lock);
+ ast_pthread_mutex_unlock(&gsm_lock);
ast_update_use_count();
}
return tmp;
struct ast_filestream *tmp;
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
memset(tmp, 0, sizeof(struct ast_filestream));
- if (pthread_mutex_lock(&gsm_lock)) {
+ if (ast_pthread_mutex_lock(&gsm_lock)) {
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
free(tmp);
return NULL;
tmp->owner = NULL;
tmp->lasttimeout = -1;
glistcnt++;
- pthread_mutex_unlock(&gsm_lock);
+ ast_pthread_mutex_unlock(&gsm_lock);
ast_update_use_count();
} else
ast_log(LOG_WARNING, "Out of memory\n");
static void gsm_close(struct ast_filestream *s)
{
struct ast_filestream *tmp, *tmpl = NULL;
- if (pthread_mutex_lock(&gsm_lock)) {
+ if (ast_pthread_mutex_lock(&gsm_lock)) {
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
return;
}
ast_sched_del(s->owner->sched, s->owner->streamid);
s->owner->streamid = -1;
}
- pthread_mutex_unlock(&gsm_lock);
+ ast_pthread_mutex_unlock(&gsm_lock);
ast_update_use_count();
if (!tmp)
ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
int unload_module()
{
struct ast_filestream *tmp, *tmpl;
- if (pthread_mutex_lock(&gsm_lock)) {
+ if (ast_pthread_mutex_lock(&gsm_lock)) {
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
return -1;
}
tmp = tmp->next;
free(tmpl);
}
- pthread_mutex_unlock(&gsm_lock);
+ ast_pthread_mutex_unlock(&gsm_lock);
return ast_format_unregister(name);
}
int usecount()
{
int res;
- if (pthread_mutex_lock(&gsm_lock)) {
+ if (ast_pthread_mutex_lock(&gsm_lock)) {
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
return -1;
}
res = glistcnt;
- pthread_mutex_unlock(&gsm_lock);
+ ast_pthread_mutex_unlock(&gsm_lock);
return res;
}
struct ast_filestream *tmp;
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
memset(tmp, 0, sizeof(struct ast_filestream));
- if (pthread_mutex_lock(&vox_lock)) {
+ if (ast_pthread_mutex_lock(&vox_lock)) {
ast_log(LOG_WARNING, "Unable to lock vox list\n");
free(tmp);
return NULL;
tmp->fr.mallocd = 0;
tmp->lasttimeout = -1;
glistcnt++;
- pthread_mutex_unlock(&vox_lock);
+ ast_pthread_mutex_unlock(&vox_lock);
ast_update_use_count();
}
return tmp;
struct ast_filestream *tmp;
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
memset(tmp, 0, sizeof(struct ast_filestream));
- if (pthread_mutex_lock(&vox_lock)) {
+ if (ast_pthread_mutex_lock(&vox_lock)) {
ast_log(LOG_WARNING, "Unable to lock vox list\n");
free(tmp);
return NULL;
tmp->owner = NULL;
tmp->lasttimeout = -1;
glistcnt++;
- pthread_mutex_unlock(&vox_lock);
+ ast_pthread_mutex_unlock(&vox_lock);
ast_update_use_count();
} else
ast_log(LOG_WARNING, "Out of memory\n");
static void vox_close(struct ast_filestream *s)
{
struct ast_filestream *tmp, *tmpl = NULL;
- if (pthread_mutex_lock(&vox_lock)) {
+ if (ast_pthread_mutex_lock(&vox_lock)) {
ast_log(LOG_WARNING, "Unable to lock vox list\n");
return;
}
ast_sched_del(s->owner->sched, s->owner->streamid);
s->owner->streamid = -1;
}
- pthread_mutex_unlock(&vox_lock);
+ ast_pthread_mutex_unlock(&vox_lock);
ast_update_use_count();
if (!tmp)
ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
int unload_module()
{
struct ast_filestream *tmp, *tmpl;
- if (pthread_mutex_lock(&vox_lock)) {
+ if (ast_pthread_mutex_lock(&vox_lock)) {
ast_log(LOG_WARNING, "Unable to lock vox list\n");
return -1;
}
tmp = tmp->next;
free(tmpl);
}
- pthread_mutex_unlock(&vox_lock);
+ ast_pthread_mutex_unlock(&vox_lock);
return ast_format_unregister(name);
}
int usecount()
{
int res;
- if (pthread_mutex_lock(&vox_lock)) {
+ if (ast_pthread_mutex_lock(&vox_lock)) {
ast_log(LOG_WARNING, "Unable to lock vox list\n");
return -1;
}
res = glistcnt;
- pthread_mutex_unlock(&vox_lock);
+ ast_pthread_mutex_unlock(&vox_lock);
return res;
}
free(tmp);
return NULL;
}
- if (pthread_mutex_lock(&wav_lock)) {
+ if (ast_pthread_mutex_lock(&wav_lock)) {
ast_log(LOG_WARNING, "Unable to lock wav list\n");
free(tmp);
return NULL;
tmp->secondhalf = 0;
tmp->lasttimeout = -1;
glistcnt++;
- pthread_mutex_unlock(&wav_lock);
+ ast_pthread_mutex_unlock(&wav_lock);
ast_update_use_count();
}
return tmp;
free(tmp);
return NULL;
}
- if (pthread_mutex_lock(&wav_lock)) {
+ if (ast_pthread_mutex_lock(&wav_lock)) {
ast_log(LOG_WARNING, "Unable to lock wav list\n");
free(tmp);
return NULL;
tmp->owner = NULL;
tmp->lasttimeout = -1;
glistcnt++;
- pthread_mutex_unlock(&wav_lock);
+ ast_pthread_mutex_unlock(&wav_lock);
ast_update_use_count();
} else
ast_log(LOG_WARNING, "Out of memory\n");
{
struct ast_filestream *tmp, *tmpl = NULL;
char zero = 0;
- if (pthread_mutex_lock(&wav_lock)) {
+ if (ast_pthread_mutex_lock(&wav_lock)) {
ast_log(LOG_WARNING, "Unable to lock wav list\n");
return;
}
ast_sched_del(s->owner->sched, s->owner->streamid);
s->owner->streamid = -1;
}
- pthread_mutex_unlock(&wav_lock);
+ ast_pthread_mutex_unlock(&wav_lock);
ast_update_use_count();
if (!tmp)
ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
int unload_module()
{
struct ast_filestream *tmp, *tmpl;
- if (pthread_mutex_lock(&wav_lock)) {
+ if (ast_pthread_mutex_lock(&wav_lock)) {
ast_log(LOG_WARNING, "Unable to lock wav list\n");
return -1;
}
tmp = tmp->next;
free(tmpl);
}
- pthread_mutex_unlock(&wav_lock);
+ ast_pthread_mutex_unlock(&wav_lock);
return ast_format_unregister(name);
}
int usecount()
{
int res;
- if (pthread_mutex_lock(&wav_lock)) {
+ if (ast_pthread_mutex_lock(&wav_lock)) {
ast_log(LOG_WARNING, "Unable to lock wav list\n");
return -1;
}
res = glistcnt;
- pthread_mutex_unlock(&wav_lock);
+ ast_pthread_mutex_unlock(&wav_lock);
return res;
}
return RESULT_SHOWUSAGE;
ast_cli(fd, " Translation times between formats (in milliseconds)\n");
ast_cli(fd, " Destination Format\n");
- pthread_mutex_lock(&list_lock);
+ ast_pthread_mutex_lock(&list_lock);
for (x=0;x<SHOW_TRANS; x++) {
if (x == 1)
strcpy(line, " Src ");
snprintf(line + strlen(line), sizeof(line) - strlen(line), "\n");
ast_cli(fd, line);
}
- pthread_mutex_unlock(&list_lock);
+ ast_pthread_mutex_unlock(&list_lock);
return RESULT_SUCCESS;
}
calc_cost(t);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Registered translator '%s' from format %d to %d, cost %d\n", t->name, t->srcfmt, t->dstfmt, t->cost);
- pthread_mutex_lock(&list_lock);
+ ast_pthread_mutex_lock(&list_lock);
if (!added_cli) {
ast_cli_register(&show_trans);
added_cli++;
t->next = list;
list = t;
rebuild_matrix();
- pthread_mutex_unlock(&list_lock);
+ ast_pthread_mutex_unlock(&list_lock);
return 0;
}
int ast_unregister_translator(struct ast_translator *t)
{
struct ast_translator *u, *ul = NULL;
- pthread_mutex_lock(&list_lock);
+ ast_pthread_mutex_lock(&list_lock);
u = list;
while(u) {
if (u == t) {
u = u->next;
}
rebuild_matrix();
- pthread_mutex_unlock(&list_lock);
+ ast_pthread_mutex_unlock(&list_lock);
return (u ? 0 : -1);
}
int bestdst=0;
int cur = 1;
int besttime=999999999;
- pthread_mutex_lock(&list_lock);
+ ast_pthread_mutex_lock(&list_lock);
for (y=0;y<MAX_FORMAT;y++) {
if ((cur & *dst) && (cur & *srcs)) {
/* This is a common format to both. Pick it if we don't have one already */
*dst = bestdst;
best = 0;
}
- pthread_mutex_unlock(&list_lock);
+ ast_pthread_mutex_unlock(&list_lock);
return best;
}