示例#1
0
文件: timing.c 项目: aderbas/asterisk
struct ast_timer *ast_timer_open(void)
{
	int fd = -1;
	struct timing_holder *h;
	struct ast_timer *t = NULL;

	ast_heap_rdlock(timing_interfaces);

	if ((h = ast_heap_peek(timing_interfaces, 1))) {
		fd = h->iface->timer_open();
		ast_module_ref(h->mod);
	}

	if (fd != -1) {
		if (!(t = ast_calloc(1, sizeof(*t)))) {
			h->iface->timer_close(fd);
		} else {
			t->fd = fd;
			t->holder = h;
		}
	}

	ast_heap_unlock(timing_interfaces);

	return t;
}
示例#2
0
文件: timing.c 项目: pruiz/asterisk
struct ast_timer *ast_timer_open(void)
{
	void *data = NULL;
	struct timing_holder *h;
	struct ast_timer *t = NULL;

	ast_heap_rdlock(timing_interfaces);

	if ((h = ast_heap_peek(timing_interfaces, 1))) {
		data = h->iface->timer_open();
		ast_module_ref(h->mod);
	}

	if (data) {
		if (!(t = ast_calloc(1, sizeof(*t)))) {
			h->iface->timer_close(data);
		} else {
			t->data = data;
			t->holder = h;
		}
	}

	ast_heap_unlock(timing_interfaces);

	return t;
}
示例#3
0
$NetBSD$

--- main/sched.c.orig	2010-12-20 17:15:54.000000000 +0000
+++ main/sched.c
@@ -553,12 +553,12 @@ void ast_sched_dump(struct ast_sched_con
 		struct timeval delta;
 		q = ast_heap_peek(con->sched_heap, x);
 		delta = ast_tvsub(q->when, when);
-		ast_debug(1, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n", 
+		ast_debug(1, "|%.4d | %-15p | %-15p | %.6jd : %.6jd |\n", 
 			q->id,
 			q->callback,
 			q->data,
-			(long)delta.tv_sec,
-			(long int)delta.tv_usec);
+			(intmax_t)delta.tv_sec,
+			(intmax_t)delta.tv_usec);
 	}
 	ast_mutex_unlock(&con->lock);
 	ast_debug(1, "=============================================================\n");