[asterisk-commits] russell: branch russell/sched_thread r140558 - in /team/russell/sched_thread:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 2 09:39:28 CDT 2008


Author: russell
Date: Tue Sep  2 09:39:28 2008
New Revision: 140558

URL: http://svn.digium.com/view/asterisk?view=rev&rev=140558
Log:
s/sched_thread/ast_sched_thread/g

Modified:
    team/russell/sched_thread/channels/chan_sip.c
    team/russell/sched_thread/include/asterisk/sched.h
    team/russell/sched_thread/main/sched.c

Modified: team/russell/sched_thread/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/sched_thread/channels/chan_sip.c?view=diff&rev=140558&r1=140557&r2=140558
==============================================================================
--- team/russell/sched_thread/channels/chan_sip.c (original)
+++ team/russell/sched_thread/channels/chan_sip.c Tue Sep  2 09:39:28 2008
@@ -832,7 +832,7 @@
 static int sip_reloading = FALSE;                       /*!< Flag for avoiding multiple reloads at the same time */
 static enum channelreloadreason sip_reloadreason;       /*!< Reason for last reload/load of configuration */
 
-static struct sched_thread *sched;     /*!< The scheduling context */
+static struct ast_sched_thread *sched;     /*!< The scheduling context */
 static struct io_context *io;           /*!< The IO context */
 static int *sipsock_read_id;            /*!< ID of IO entry for sipsock FD */
 
@@ -2491,22 +2491,22 @@
 	/* remove all current packets in this dialog */
 	while((cp = dialog->packets)) {
 		dialog->packets = dialog->packets->next;
-		if (sched_thread_del(sched, cp->retransid) > -1) {
+		if (ast_sched_thread_del(sched, cp->retransid) > -1) {
 			dialog_unref(cp->owner, "remove all current packets in this dialog, and the pointer to the dialog too as part of __sip_destroy");
 		}
 		ast_free(cp);
 	}
 
-	if (sched_thread_del(sched, dialog->waitid) > -1) {
+	if (ast_sched_thread_del(sched, dialog->waitid) > -1) {
 		dialog_unref(dialog, "when you delete the waitid sched, you should dec the refcount for the stored dialog ptr");
 	}
 
-	if (sched_thread_del(sched, dialog->initid) > -1) {
+	if (ast_sched_thread_del(sched, dialog->initid) > -1) {
 		dialog_unref(dialog, "when you delete the initid sched, you should dec the refcount for the stored dialog ptr");
 	}
 	
 	if (dialog->autokillid > -1) {
-		if (sched_thread_del(sched, dialog->autokillid) > -1) {
+		if (ast_sched_thread_del(sched, dialog->autokillid) > -1) {
 			dialog_unref(dialog, "when you delete the autokillid sched, you should dec the refcount for the stored dialog ptr");
 		}
 	}
@@ -3114,8 +3114,8 @@
 		siptimer_a = pkt->timer_t1 * 2;
 
 	/* Schedule retransmission */
-	sched_thread_del(sched, pkt->retransid);
-	pkt->retransid = sched_thread_add_variable(sched, siptimer_a, retrans_pkt, pkt, 1);
+	ast_sched_thread_del(sched, pkt->retransid);
+	pkt->retransid = ast_sched_thread_add_variable(sched, siptimer_a, retrans_pkt, pkt, 1);
 
 	if (sipdebug)
 		ast_debug(4, "*** SIP TIMER: Initializing retransmit timer on packet: Id  #%d\n", pkt->retransid);
@@ -3202,7 +3202,7 @@
 
 	if (p->do_history)
 		append_history(p, "SchedDestroy", "%d ms", ms);
-	p->autokillid = sched_thread_add(sched, ms, __sip_autodestruct, dialog_ref(p, "setting ref as passing into ast_sched_add for __sip_autodestruct"));
+	p->autokillid = ast_sched_thread_add(sched, ms, __sip_autodestruct, dialog_ref(p, "setting ref as passing into ast_sched_add for __sip_autodestruct"));
 
 	if (p->stimer && p->stimer->st_active == TRUE && p->stimer->st_schedid > 0)
 		stop_session_timer(p);
@@ -3218,7 +3218,7 @@
 	if (p->autokillid > -1) {
 		int res3;
 		
-		if (!(res3 = sched_thread_del(sched, p->autokillid))) {
+		if (!(res3 = ast_sched_thread_del(sched, p->autokillid))) {
 			append_history(p, "CancelDestroy", "");
 			p->autokillid = -1;
 			dialog_unref(p, "dialog unrefd because autokillid is de-sched'd");
@@ -3271,7 +3271,7 @@
 			 * the packet's retransid will be set to -1. The atomicity of the setting and checking
 			 * of the retransid to -1 is ensured since in both cases p's lock is held.
 			 */
-			while (cur->retransid > -1 && sched_thread_del(sched, cur->retransid)) {
+			while (cur->retransid > -1 && ast_sched_thread_del(sched, cur->retransid)) {
 				sip_pvt_unlock(p);
 				usleep(1);
 				sip_pvt_lock(p);
@@ -3320,7 +3320,7 @@
 				if (sipdebug)
 					ast_debug(4, "*** SIP TIMER: Cancelling retransmission #%d - %s (got response)\n", cur->retransid, sip_methods[sipmethod].text);
 			}
-			sched_thread_del(sched, cur->retransid);
+			ast_sched_thread_del(sched, cur->retransid);
 			res = 0;
 			break;
 		}
@@ -3799,8 +3799,8 @@
 	 *
 	 * NOTE: once peer is refcounted, this probably is no longer necessary.
 	 */
-	sched_thread_del(sched, peer->expire);
-	sched_thread_del(sched, peer->pokeexpire);
+	ast_sched_thread_del(sched, peer->expire);
+	ast_sched_thread_del(sched, peer->pokeexpire);
 
 	register_peer_exten(peer, FALSE);
 	ast_free_ha(peer->ha);
@@ -4029,8 +4029,8 @@
 		/* Cache peer */
 		ast_copy_flags(&peer->flags[1], &global_flags[1], SIP_PAGE2_RTAUTOCLEAR|SIP_PAGE2_RTCACHEFRIENDS);
 		if (ast_test_flag(&global_flags[1], SIP_PAGE2_RTAUTOCLEAR)) {
-			sched_thread_del(sched, peer->expire);
-			peer->expire = sched_thread_add(sched, global_rtautoclear * 1000, expire_register, peer);
+			ast_sched_thread_del(sched, peer->expire);
+			peer->expire = ast_sched_thread_add(sched, global_rtautoclear * 1000, expire_register, peer);
 			/* we could be incr. its refcount right here, but I guess, since
 			   peers hang around until module unload time anyway, it's not worth the trouble */
 		}
@@ -4508,10 +4508,10 @@
 		p->invitestate = INV_CALLING;
 	
 		/* Initialize auto-congest time */
-		if (sched_thread_del(sched, p->initid) > -1) { 
+		if (ast_sched_thread_del(sched, p->initid) > -1) { 
 			dialog_unref(p, "dialog ptr dec when SCHED_REPLACE add failed");
 		}
-		p->initid = sched_thread_add(sched, p->timer_b, auto_congest,
+		p->initid = ast_sched_thread_add(sched, p->timer_b, auto_congest,
 				dialog_ref(p, "dialog ptr inc when SCHED_REPLACE add succeeded"));
 		if (p->initid == -1) {
 			dialog_unref(p, "sched add failed");
@@ -4536,8 +4536,8 @@
 		reg->call = dialog_unref(reg->call, "unref reg->call");
 		/* reg->call = sip_destroy(reg->call); */
 	}
-	sched_thread_del(sched, reg->expire);	
-	sched_thread_del(sched, reg->timeout);
+	ast_sched_thread_del(sched, reg->expire);	
+	ast_sched_thread_del(sched, reg->timeout);
 	
 	ast_string_field_free_memory(reg);
 	ast_atomic_fetchadd_int(&regobjs, -1);
@@ -4623,7 +4623,7 @@
 	/* Destroy Session-Timers if allocated */
 	if (p->stimer) {
 		if (p->stimer->st_active == TRUE && p->stimer->st_schedid > -1)
-			sched_thread_del(sched, p->stimer->st_schedid);
+			ast_sched_thread_del(sched, p->stimer->st_schedid);
 		ast_free(p->stimer);
 		p->stimer = NULL;
 	}
@@ -5111,7 +5111,7 @@
 				   but we can't send one while we have "INVITE" outstanding. */
 				ast_set_flag(&p->flags[0], SIP_PENDINGBYE);	
 				ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);	
-				if (sched_thread_del(sched, p->waitid) > -1) {
+				if (ast_sched_thread_del(sched, p->waitid) > -1) {
 					dialog_unref(p, "when you delete the waitid sched, you should dec the refcount for the stored dialog ptr");
 				}
 				if (sip_cancel_destroy(p))
@@ -6058,14 +6058,14 @@
 	p->ocseq = INITIAL_CSEQ;
 
 	if (sip_methods[intended_method].need_rtp) {
-		p->rtp = ast_rtp_new_with_bindaddr(sched_thread_get_context(sched), io, 1, 0, bindaddr.sin_addr);
+		p->rtp = ast_rtp_new_with_bindaddr(ast_sched_thread_get_context(sched), io, 1, 0, bindaddr.sin_addr);
 		/* If the global videosupport flag is on, we always create a RTP interface for video */
 		if (ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT))
-			p->vrtp = ast_rtp_new_with_bindaddr(sched_thread_get_context(sched), io, 1, 0, bindaddr.sin_addr);
+			p->vrtp = ast_rtp_new_with_bindaddr(ast_sched_thread_get_context(sched), io, 1, 0, bindaddr.sin_addr);
  		if (ast_test_flag(&p->flags[1], SIP_PAGE2_TEXTSUPPORT))
- 			p->trtp = ast_rtp_new_with_bindaddr(sched_thread_get_context(sched), io, 1, 0, bindaddr.sin_addr);
+ 			p->trtp = ast_rtp_new_with_bindaddr(ast_sched_thread_get_context(sched), io, 1, 0, bindaddr.sin_addr);
 		if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT))
-			p->udptl = ast_udptl_new_with_bindaddr(sched_thread_get_context(sched), io, 0, bindaddr.sin_addr);
+			p->udptl = ast_udptl_new_with_bindaddr(ast_sched_thread_get_context(sched), io, 0, bindaddr.sin_addr);
  		if (!p->rtp|| (ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT) && !p->vrtp) 
 				|| (ast_test_flag(&p->flags[1], SIP_PAGE2_TEXTSUPPORT) && !p->trtp)) {
  			ast_log(LOG_WARNING, "Unable to create RTP audio %s%ssession: %s\n",
@@ -9724,17 +9724,17 @@
 			dialog_unlink_all(p, TRUE, TRUE);
 			p = dialog_unref(p, "unref dialog after unlink_all");
 			if (r->timeout > -1) {
-				if (sched_thread_del(sched, r->timeout) > -1) {
+				if (ast_sched_thread_del(sched, r->timeout) > -1) {
 					registry_unref(r, "del for REPLACE of registry ptr");
 				}
-				r->timeout = sched_thread_add(sched, global_reg_timeout * 1000, sip_reg_timeout, 
+				r->timeout = ast_sched_thread_add(sched, global_reg_timeout * 1000, sip_reg_timeout, 
 						registry_addref(r, "add"));
 				if (r->timeout == -1) {
 					registry_unref(r, "sched_add failed");
 				}
 				ast_log(LOG_WARNING, "Still have a registration timeout for %s@%s (create_addr() error), %d\n", r->username, r->hostname, r->timeout);
 			} else {
-				r->timeout = sched_thread_add(sched, global_reg_timeout * 1000, sip_reg_timeout, registry_addref(r, "add for REPLACE registry ptr"));
+				r->timeout = ast_sched_thread_add(sched, global_reg_timeout * 1000, sip_reg_timeout, registry_addref(r, "add for REPLACE registry ptr"));
 				if (r->timeout == -1) {
 					registry_unref(r, "add failed");
 				}
@@ -9792,10 +9792,10 @@
 	if (auth == NULL)  {
 		if (r->timeout > -1)
 			ast_log(LOG_WARNING, "Still have a registration timeout, #%d - deleting it\n", r->timeout);
-		if (!sched_thread_del(sched, r->timeout)) {
+		if (!ast_sched_thread_del(sched, r->timeout)) {
 			registry_unref(r, "");
 		}
-		r->timeout = sched_thread_add(sched, global_reg_timeout * 1000, sip_reg_timeout,
+		r->timeout = ast_sched_thread_add(sched, global_reg_timeout * 1000, sip_reg_timeout,
 				registry_addref(r, ""));
 		if (r->timeout == -1) {
 			registry_unref(r, "");
@@ -10188,14 +10188,14 @@
 	peer->addr.sin_port = htons(port);
 	if (sipsock < 0) {
 		/* SIP isn't up yet, so schedule a poke only, pretty soon */
-		sched_thread_del(sched, peer->pokeexpire);
-		peer->pokeexpire = sched_thread_add(sched, ast_random() % 5000 + 1, sip_poke_peer_s, peer);
+		ast_sched_thread_del(sched, peer->pokeexpire);
+		peer->pokeexpire = ast_sched_thread_add(sched, ast_random() % 5000 + 1, sip_poke_peer_s, peer);
 	} else {
 		sip_poke_peer(peer, 0);
 	}
 	/* XXX refcount not handled, will be fixed in another branch */
-	sched_thread_del(sched, peer->expire);
-	peer->expire = sched_thread_add(sched, (expire + 10) * 1000, expire_register, peer);
+	ast_sched_thread_del(sched, peer->expire);
+	peer->expire = ast_sched_thread_add(sched, (expire + 10) * 1000, expire_register, peer);
 	register_peer_exten(peer, TRUE);
 }
 
@@ -10323,12 +10323,12 @@
 	if (ast_strlen_zero(curi) && ast_strlen_zero(expires)) {
 		/* If we have an active registration, tell them when the registration is going to expire */
 		if (peer->expire > -1 && !ast_strlen_zero(peer->fullcontact))
-			pvt->expiry = sched_thread_when(sched, peer->expire);
+			pvt->expiry = ast_sched_thread_when(sched, peer->expire);
 		return PARSE_REGISTER_QUERY;
 	} else if (!strcasecmp(curi, "*") || !expire) {	/* Unregister this peer */
 		/* This means remove all registrations and return OK */
 		memset(&peer->addr, 0, sizeof(peer->addr));
-		sched_thread_del(sched, peer->expire);
+		ast_sched_thread_del(sched, peer->expire);
 
 		destroy_association(peer);
 		
@@ -10385,13 +10385,13 @@
 	if (!ast_strlen_zero(curi) && ast_strlen_zero(peer->username))
 		ast_copy_string(peer->username, curi, sizeof(peer->username));
 
-	sched_thread_del(sched, peer->expire);
+	ast_sched_thread_del(sched, peer->expire);
 	if (expire > max_expiry)
 		expire = max_expiry;
 	if (expire < min_expiry)
 		expire = min_expiry;
 	peer->expire = peer->is_realtime && !ast_test_flag(&peer->flags[1], SIP_PAGE2_RTCACHEFRIENDS) ? -1 :
-		sched_thread_add(sched, (expire + 10) * 1000, expire_register, peer);
+		ast_sched_thread_add(sched, (expire + 10) * 1000, expire_register, peer);
 	pvt->expiry = expire;
 	snprintf(data, sizeof(data), "%s:%d:%d:%s:%s", ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expire, peer->username, peer->fullcontact);
 	/* Saving TCP connections is useless, we won't be able to reconnect 
@@ -13142,7 +13142,7 @@
 		ast_cli(fd, "  Dynamic      : %s\n", cli_yesno(peer->host_dynamic));
 		ast_cli(fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
 		ast_cli(fd, "  MaxCallBR    : %d kbps\n", peer->maxcallbitrate);
-		ast_cli(fd, "  Expire       : %ld\n", sched_thread_when(sched, peer->expire));
+		ast_cli(fd, "  Expire       : %ld\n", ast_sched_thread_when(sched, peer->expire));
 		ast_cli(fd, "  Insecure     : %s\n", insecure2str(ast_test_flag(&peer->flags[0], SIP_INSECURE)));
 		ast_cli(fd, "  Nat          : %s\n", nat2str(ast_test_flag(&peer->flags[0], SIP_NAT)));
 		ast_cli(fd, "  ACL          : %s\n", cli_yesno(peer->ha != NULL));
@@ -13247,7 +13247,7 @@
 		astman_append(s, "MaxCallBR: %d kbps\r\n", peer->maxcallbitrate);
 		astman_append(s, "Dynamic: %s\r\n", peer->host_dynamic?"Y":"N");
 		astman_append(s, "Callerid: %s\r\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, ""));
-		astman_append(s, "RegExpire: %ld seconds\r\n", sched_thread_when(sched, peer->expire));
+		astman_append(s, "RegExpire: %ld seconds\r\n", ast_sched_thread_when(sched, peer->expire));
 		astman_append(s, "SIP-AuthInsecure: %s\r\n", insecure2str(ast_test_flag(&peer->flags[0], SIP_INSECURE)));
 		astman_append(s, "SIP-NatSupport: %s\r\n", nat2str(ast_test_flag(&peer->flags[0], SIP_NAT)));
 		astman_append(s, "ACL: %s\r\n", (peer->ha?"Y":"N"));
@@ -13339,7 +13339,7 @@
 		return NULL;
 	}
 	ast_cli(a->fd, "\n");
-	ast_sched_report(sched_thread_get_context(sched), cbuf, sizeof(cbuf), &cbnames);
+	ast_sched_report(ast_sched_thread_get_context(sched), cbuf, sizeof(cbuf), &cbnames);
 	ast_cli(a->fd, "%s", cbuf);
 	return CLI_SUCCESS;
 }
@@ -15201,7 +15201,7 @@
 
 	/* Acknowledge sequence number - This only happens on INVITE from SIP-call */
 	/* Don't auto congest anymore since we've gotten something useful back */
-	if (!sched_thread_del(sched, p->initid)) {
+	if (!ast_sched_thread_del(sched, p->initid)) {
 		dialog_unref(p, "when you delete the initid sched, you should dec the refcount for the stored dialog ptr");
 	}
 
@@ -15505,7 +15505,7 @@
 				/* Reset the flag after a while 
 				 */
 				int wait = 3 + ast_random() % 5;
-				p->waitid = sched_thread_add(sched, wait, sip_reinvite_retry, dialog_ref(p, "passing dialog ptr into sched structure based on waitid for sip_reinvite_retry.")); 
+				p->waitid = ast_sched_thread_add(sched, wait, sip_reinvite_retry, dialog_ref(p, "passing dialog ptr into sched structure based on waitid for sip_reinvite_retry.")); 
 				ast_log(LOG_WARNING, "just did sched_add waitid(%d) for sip_reinvite_retry for dialog %s in handle_response_invite\n", p->waitid, p->callid);
 				ast_debug(2, "Reinvite race. Waiting %d secs before retry\n", wait);
 			}
@@ -15642,7 +15642,7 @@
 		break;
 	case 403:	/* Forbidden */
 		ast_log(LOG_WARNING, "Forbidden - wrong password on authentication for REGISTER for '%s' to '%s'\n", p->registry->username, p->registry->hostname);
-		sched_thread_del(sched, r->timeout);
+		ast_sched_thread_del(sched, r->timeout);
 		r->regstate = REG_STATE_NOAUTH;
 		p->needdestroy = 1;
 		break;
@@ -15652,7 +15652,7 @@
 		if (r->call)
 			r->call = dialog_unref(r->call, "unsetting registry->call pointer-- case 404");
 		r->regstate = REG_STATE_REJECTED;
-		sched_thread_del(sched, r->timeout);
+		ast_sched_thread_del(sched, r->timeout);
 		break;
 	case 407:	/* Proxy auth */
 		if (p->authtries == MAX_AUTHTRIES || do_register_auth(p, req, resp)) {
@@ -15667,7 +15667,7 @@
 	case 423:	/* Interval too brief */
 		r->expiry = atoi(get_header(req, "Min-Expires"));
 		ast_log(LOG_WARNING, "Got 423 Interval too brief for service %s@%s, minimum is %d seconds\n", p->registry->username, p->registry->hostname, r->expiry);
-		sched_thread_del(sched, r->timeout);
+		ast_sched_thread_del(sched, r->timeout);
 		r->timeout = -1;
 		if (r->call) {
 			r->call = dialog_unref(r->call, "unsetting registry->call pointer-- case 423");
@@ -15689,7 +15689,7 @@
 		if (r->call)
 			r->call = dialog_unref(r->call, "unsetting registry->call pointer-- case 479");
 		r->regstate = REG_STATE_REJECTED;
-		sched_thread_del(sched, r->timeout);
+		ast_sched_thread_del(sched, r->timeout);
 		break;
 	case 200:	/* 200 OK */
 		if (!r) {
@@ -15706,7 +15706,7 @@
 		if (r->timeout > -1) {
 			ast_debug(1, "Cancelling timeout %d\n", r->timeout);
 		}
-		sched_thread_del(sched, r->timeout);
+		ast_sched_thread_del(sched, r->timeout);
 		if (r->call)
 			r->call = dialog_unref(r->call, "unsetting registry->call pointer-- case 200");
 		p->registry = registry_unref(p->registry, "unref registry entry p->registry");
@@ -15716,7 +15716,7 @@
 		
 		/* set us up for re-registering */
 		/* figure out how long we got registered for */
-		sched_thread_del(sched, r->expire);
+		ast_sched_thread_del(sched, r->expire);
 		
 		/* according to section 6.13 of RFC, contact headers override
 		   expires headers, so check those first */
@@ -15761,10 +15761,10 @@
 		r->refresh= (int) expires_ms / 1000;
 		
 		/* Schedule re-registration before we expire */
-		if (!sched_thread_del(sched, r->expire)) {
+		if (!ast_sched_thread_del(sched, r->expire)) {
 			registry_unref(r, "");
 		}
-		r->expire = sched_thread_add(sched, expires_ms, sip_reregister, registry_addref(r, ""));
+		r->expire = ast_sched_thread_add(sched, expires_ms, sip_reregister, registry_addref(r, ""));
 		if (r->expire == -1) {
 			registry_unref(r, "");
 		}
@@ -15817,8 +15817,8 @@
 	p->needdestroy = 1;
 
 	/* Try again eventually */
-	sched_thread_del(sched, peer->pokeexpire);
-	peer->pokeexpire = sched_thread_add(sched, is_reachable ? peer->qualifyfreq : DEFAULT_FREQ_NOTOK, sip_poke_peer_s, peer);
+	ast_sched_thread_del(sched, peer->pokeexpire);
+	peer->pokeexpire = ast_sched_thread_add(sched, is_reachable ? peer->qualifyfreq : DEFAULT_FREQ_NOTOK, sip_poke_peer_s, peer);
 	/* unref_peer(peer, "unref relatedpeer ptr var at end of handle_response_peerpoke"); */
 }
 
@@ -17194,7 +17194,7 @@
 			ast_string_field_set(p, theirtag, NULL);
 			for (pkt = p->packets; pkt; pkt = pkt->next) {
 				if (pkt->seqno == p->icseq && pkt->method == SIP_INVITE) {
-					sched_thread_del(sched, pkt->retransid);
+					ast_sched_thread_del(sched, pkt->retransid);
 				}
 			}
 			return transmit_invite(p, SIP_INVITE, 1, 3);
@@ -19649,7 +19649,7 @@
 	}
 
 	if (p->stimer->st_active == TRUE) {
-		sched_thread_del(sched, p->stimer->st_schedid);
+		ast_sched_thread_del(sched, p->stimer->st_schedid);
 		ast_debug(2, "Session timer stopped: %d - %s\n", p->stimer->st_schedid, p->callid);
 		start_session_timer(p);
 	}
@@ -19666,7 +19666,7 @@
 
 	if (p->stimer->st_active == TRUE) {
 		p->stimer->st_active = FALSE;
-		sched_thread_del(sched, p->stimer->st_schedid);
+		ast_sched_thread_del(sched, p->stimer->st_schedid);
 		ast_debug(2, "Session timer stopped: %d - %s\n", p->stimer->st_schedid, p->callid);
 	}
 }
@@ -19680,7 +19680,7 @@
 		return;
 	}
 
-	p->stimer->st_schedid  = sched_thread_add(sched, p->stimer->st_interval * 1000 / 2, proc_session_timer, p);
+	p->stimer->st_schedid  = ast_sched_thread_add(sched, p->stimer->st_interval * 1000 / 2, proc_session_timer, p);
 	if (p->stimer->st_schedid < 0) {
 		ast_log(LOG_ERROR, "ast_sched_add failed.\n");
 	}
@@ -19954,8 +19954,8 @@
 	peer->lastms = -1;
 	ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "SIP/%s", peer->name);
 	/* Try again quickly */
-	sched_thread_del(sched, peer->pokeexpire);
-	peer->pokeexpire = sched_thread_add(sched, DEFAULT_FREQ_NOTOK, sip_poke_peer_s, peer);
+	ast_sched_thread_del(sched, peer->pokeexpire);
+	peer->pokeexpire = ast_sched_thread_add(sched, DEFAULT_FREQ_NOTOK, sip_poke_peer_s, peer);
 	return 0;
 }
 
@@ -19972,7 +19972,7 @@
 	if ((!peer->maxms && !force) || !peer->addr.sin_addr.s_addr) {
 		/* IF we have no IP, or this isn't to be monitored, return
 		  immediately after clearing things out */
-		sched_thread_del(sched, peer->pokeexpire);
+		ast_sched_thread_del(sched, peer->pokeexpire);
 		
 		peer->lastms = 0;
 		if (peer->call) {
@@ -20015,7 +20015,7 @@
 	build_callid_pvt(p);
 	ao2_t_link(dialogs, p, "Linking in under new name");
 
-	sched_thread_del(sched, peer->pokeexpire);
+	ast_sched_thread_del(sched, peer->pokeexpire);
 	
 	if (p->relatedpeer)
 		p->relatedpeer = unref_peer(p->relatedpeer,"unsetting the relatedpeer field in the dialog, before it is set to something else.");
@@ -20032,9 +20032,9 @@
 		sip_poke_noanswer(peer);	/* Immediately unreachable, network problems */
 	} else if (!force) {
 		if (peer->pokeexpire > -1) {
-			sched_thread_del(sched, peer->pokeexpire);
-		}
-		peer->pokeexpire = sched_thread_add(sched, peer->maxms * 2, sip_poke_noanswer, peer);
+			ast_sched_thread_del(sched, peer->pokeexpire);
+		}
+		peer->pokeexpire = ast_sched_thread_add(sched, peer->maxms * 2, sip_poke_noanswer, peer);
 	}
 	dialog_unref(p, "unref dialog at end of sip_poke_peer, obtained from sip_alloc, just before it goes out of scope");
 	return 0;
@@ -20891,7 +20891,7 @@
 				peer->host_dynamic = TRUE;
 			} else {
 				/* Non-dynamic.  Make sure we become that way if we're not */
-				sched_thread_del(sched, peer->expire);
+				ast_sched_thread_del(sched, peer->expire);
 				peer->host_dynamic = FALSE;
 				srvlookup = v->value;
 			}
@@ -22432,9 +22432,9 @@
 		ao2_lock(peer);
 		ms += 100;
 		if (peer->pokeexpire > -1) {
-			sched_thread_del(sched, peer->pokeexpire);
-		}
-		peer->pokeexpire = sched_thread_add(sched, ms, sip_poke_peer_s, peer);
+			ast_sched_thread_del(sched, peer->pokeexpire);
+		}
+		peer->pokeexpire = ast_sched_thread_add(sched, ms, sip_poke_peer_s, peer);
 		ao2_unlock(peer);
 		unref_peer(peer, "toss iterator peer ptr");
 	}
@@ -22454,10 +22454,10 @@
 	ASTOBJ_CONTAINER_TRAVERSE(&regl, 1, do {
 		ASTOBJ_WRLOCK(iterator);
 		ms += regspacing;
-		if (iterator->expire > -1 && !sched_thread_del(sched, iterator->expire)) {
+		if (iterator->expire > -1 && !ast_sched_thread_del(sched, iterator->expire)) {
 			registry_unref(iterator, "");
 		}
-		iterator->expire = sched_thread_add(sched, ms, sip_reregister, registry_addref(iterator, ""));
+		iterator->expire = ast_sched_thread_add(sched, ms, sip_reregister, registry_addref(iterator, ""));
 		if (iterator->expire == -1) {
 			registry_unref(iterator, "");
 		}
@@ -22566,14 +22566,14 @@
 	
 	ASTOBJ_CONTAINER_INIT(&regl); /* Registry object list -- not searched for anything */
 
-	if (!(sched = sched_thread_create())) {
+	if (!(sched = ast_sched_thread_create())) {
 		ast_log(LOG_ERROR, "Unable to create scheduler thread\n");
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
 	if (!(io = io_context_create())) {
 		ast_log(LOG_ERROR, "Unable to create I/O context\n");
-		sched = sched_thread_destroy(sched);
+		sched = ast_sched_thread_destroy(sched);
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
@@ -22593,7 +22593,7 @@
 	if (ast_channel_register(&sip_tech)) {
 		ast_log(LOG_ERROR, "Unable to register channel type 'SIP'\n");
 		io_context_destroy(io);
-		sched = sched_thread_destroy(sched);
+		sched = ast_sched_thread_destroy(sched);
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
@@ -22751,7 +22751,7 @@
 
 	clear_sip_domains();
 	close(sipsock);
-	sched = sched_thread_destroy(sched);
+	sched = ast_sched_thread_destroy(sched);
 	con = ast_context_find(used_context);
 	if (con)
 		ast_context_destroy(con, "SIP");

Modified: team/russell/sched_thread/include/asterisk/sched.h
URL: http://svn.digium.com/view/asterisk/team/russell/sched_thread/include/asterisk/sched.h?view=diff&rev=140558&r1=140557&r2=140558
==============================================================================
--- team/russell/sched_thread/include/asterisk/sched.h (original)
+++ team/russell/sched_thread/include/asterisk/sched.h Tue Sep  2 09:39:28 2008
@@ -272,24 +272,24 @@
 /*!
  * \brief An opaque type representing a scheduler thread
  */
-struct sched_thread;
-
-struct sched_thread *sched_thread_create(void);
-
-struct sched_thread *sched_thread_destroy(struct sched_thread *st);
-
-int sched_thread_add(struct sched_thread *st, int when, ast_sched_cb cb,
+struct ast_sched_thread;
+
+struct ast_sched_thread *ast_sched_thread_create(void);
+
+struct ast_sched_thread *ast_sched_thread_destroy(struct ast_sched_thread *st);
+
+int ast_sched_thread_add(struct ast_sched_thread *st, int when, ast_sched_cb cb,
 		const void *data);
 
-int sched_thread_add_variable(struct sched_thread *st, int when, ast_sched_cb cb,
+int ast_sched_thread_add_variable(struct ast_sched_thread *st, int when, ast_sched_cb cb,
 		const void *data, int variable);
 
-int sched_thread_del(struct sched_thread *st, int id);
+int ast_sched_thread_del(struct ast_sched_thread *st, int id);
 
 /*! XXX I hate this and want it to go away eventually */
-struct sched_context *sched_thread_get_context(struct sched_thread *st);
-
-long sched_thread_when(struct sched_thread *st, int id);
+struct sched_context *ast_sched_thread_get_context(struct ast_sched_thread *st);
+
+long ast_sched_thread_when(struct ast_sched_thread *st, int id);
 
 #if defined(__cplusplus) || defined(c_plusplus)
 }

Modified: team/russell/sched_thread/main/sched.c
URL: http://svn.digium.com/view/asterisk/team/russell/sched_thread/main/sched.c?view=diff&rev=140558&r1=140557&r2=140558
==============================================================================
--- team/russell/sched_thread/main/sched.c (original)
+++ team/russell/sched_thread/main/sched.c Tue Sep  2 09:39:28 2008
@@ -70,7 +70,7 @@
 #endif
 };
 
-struct sched_thread {
+struct ast_sched_thread {
 	pthread_t thread;
 	ast_mutex_t lock;
 	ast_cond_t cond;
@@ -80,7 +80,7 @@
 
 static void *sched_run(void *data)
 {
-	struct sched_thread *st = data;
+	struct ast_sched_thread *st = data;
 
 	while (!st->stop) {
 		int ms;
@@ -119,17 +119,17 @@
 	return NULL;
 }
 
-long sched_thread_when(struct sched_thread *st, int id)
+long ast_sched_thread_when(struct ast_sched_thread *st, int id)
 {
 	return ast_sched_when(st->context, id);
 }
 
-struct sched_context *sched_thread_get_context(struct sched_thread *st)
+struct sched_context *ast_sched_thread_get_context(struct ast_sched_thread *st)
 {
 	return st->context;
 }
 
-struct sched_thread *sched_thread_destroy(struct sched_thread *st)
+struct ast_sched_thread *ast_sched_thread_destroy(struct ast_sched_thread *st)
 {
 	if (st->thread != AST_PTHREADT_NULL) {
 		ast_mutex_lock(&st->lock);
@@ -153,9 +153,9 @@
 	return NULL;
 }
 
-struct sched_thread *sched_thread_create(void)
-{
-	struct sched_thread *st;
+struct ast_sched_thread *ast_sched_thread_create(void)
+{
+	struct ast_sched_thread *st;
 
 	if (!(st = ast_calloc(1, sizeof(*st)))) {
 		return NULL;
@@ -168,20 +168,20 @@
 
 	if (!(st->context = sched_context_create())) {
 		ast_log(LOG_ERROR, "Failed to create scheduler\n");
-		sched_thread_destroy(st);
+		ast_sched_thread_destroy(st);
 		return NULL;
 	}
 	
 	if (ast_pthread_create_background(&st->thread, NULL, sched_run, st)) {
 		ast_log(LOG_ERROR, "Failed to create scheduler thread\n");
-		sched_thread_destroy(st);
+		ast_sched_thread_destroy(st);
 		return NULL;
 	}
 
 	return st;
 }
 
-int sched_thread_add_variable(struct sched_thread *st, int when, ast_sched_cb cb,
+int ast_sched_thread_add_variable(struct ast_sched_thread *st, int when, ast_sched_cb cb,
 		const void *data, int variable)
 {
 	int res;
@@ -197,7 +197,7 @@
 	return res;
 }
 
-int sched_thread_add(struct sched_thread *st, int when, ast_sched_cb cb,
+int ast_sched_thread_add(struct ast_sched_thread *st, int when, ast_sched_cb cb,
 		const void *data)
 {
 	int res;
@@ -213,7 +213,7 @@
 	return res;
 }
 
-int sched_thread_del(struct sched_thread *st, int id)
+int ast_sched_thread_del(struct ast_sched_thread *st, int id)
 {
 	return AST_SCHED_DEL(st->context, id);
 }




More information about the asterisk-commits mailing list