linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] ORTP 0.13.1 scheduler.c


From: Машкин С В
Subject: [Linphone-developers] ORTP 0.13.1 scheduler.c
Date: Tue, 13 Nov 2007 19:39:20 +0300

Hi, Simon.



While be waiting for answer for "using multi-duplex-session-set" question, I 
study source-code for oRTP 0.13.1 

and it seems, found something interesting in "scheduler.c" in 
rtp_scheduler_schedule()



-----------------------------------------

while(sched->thread_running)

{

    /* do the processing here: */

    ortp_mutex_lock(&sched->lock);



    current=sched->list;

    /* processing all scheduled rtp sessions */

    while (current!=NULL)

    {

        ortp_debug("scheduler: processing session=0x%x.\n",current);

        rtp_session_process(current,sched->time_,sched);

        current=current->next;

    }

    /* wake up all the threads that are sleeping in _select()  */

    ortp_cond_broadcast(&sched->unblock_select_cond);

    ortp_mutex_unlock(&sched->lock);

                

    /* now while the scheduler is going to sleep, the other

       threads can compute their result mask and see if they

       have to leave, or to wait for next tick   */

    //ortp_message("scheduler: sleeping.");

    timer->timer_do();

    sched->time_+=sched->timer_inc;

}

-----------------------------------------



Variable sched->time_ is used also in 

rtp_session_sendm_with_ts() and rtp_session_recvm_with_ts(),

which are in other thread, than rtp_scheduler_schedule().



So, is here some parallel-processes-programming conflict or not?



I mean, that may be it'll be more correctly to place     
ortp_mutex_unlock(&sched->lock);

after

sched->time_+=sched->timer_inc;



What do you think about?



Thanks.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]