[prev in list] [next in list] [prev in thread] [next in thread] 

List:       asterisk-dev
Subject:    Re: [asterisk-dev] ast_read and frames of type AST_FRAME_NULL?
From:       Klaus Darilion <klaus.mailinglists () pernau ! at>
Date:       2010-06-25 8:35:16
Message-ID: 4C246A44.3030006 () pernau ! at
[Download RAW message or body]

I think this thread can be interesting for you:
http://www.mail-archive.com/asterisk-dev@lists.digium.com/msg37785.html

regards
Klaus

Am 24.06.2010 17:15, schrieb Bryan Field-Elliot:
> OK here's a follow-on question:
> 
> I've altered my code, such that if ast_waitfor returns 0, it loops around and \
> basically issues another ast_waitfor. 
> My ms waitfor time is now 200. Simplified code below:
> 
> int empty_counter = 0;
> for (;;) {
> 	r = ast_waitfor(chan, 200);
> 	if (r == 0) {
> 		empty_counter++;
> 		continue;
> 	}
> 	frame = ast_read(chan);
> 	// ... do some work
> 	// how long did we wait?
> 	ast_verb(4, "waitfor returned empty %d times\n", empty_counter);
> }
> 
> I'm finding that the empty_counter is climbing into the tens and sometimes hundreds \
> of thousands. This shouldn't be possible if it's waiting 200ms each time. So my \
> follow-on question is -- is there some state that channels might get in, such that \
> ast_waitfor will return immediately rathe than waiting the number of milliseconds \
> specified in its second parameter? 
> 
> 
> 
> 
> On Jun 22, 2010, at 11:17 PM, Russell Bryant wrote:
> 
> 
> ----- Original Message -----
> > I think Russell means you're only supposed to call ast_read() if r>
> > 0, not if r == 0. Other places in the code (like app_waitforring.c and
> > app_meetme.c) seem to follow this convention.
> 
> Correct.
> 
> --
> Russell Bryant
> Digium, Inc.  |  Engineering Manager, Open Source Software
> 445 Jan Davis Drive NW   -    Huntsville, AL 35806  -  USA
> jabber: rbryant@digium.com    -=-    skype: russell-bryant
> www.digium.com -=- www.asterisk.org -=- blogs.asterisk.org
> 

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic