[quagga-dev 12128] Re: RIP interface wakeup

Donald Sharp sharpd at cumulusnetworks.com
Wed Apr 8 12:41:08 BST 2015


rip_interface_wakeup is scheduled to wakeup via this code:

    ri->t_wakeup = thread_add_timer (master, rip_interface_wakeup,
     ifp, 1);

If you look ifp is passed in.  thread_add_timer corresponds to:

/* Add timer event thread. */
struct thread *
funcname_thread_add_timer (struct thread_master *m,
           int (*func) (struct thread *),
           void *arg, long timer, const char* funcname)
{

ifp becomes void *arg for this function, and the value is stored in
thread->arg in thread_get that is eventually called..

When the timer pops thread->func is called with thread->arg in
thread_call();

donald

On Wed, Apr 8, 2015 at 1:37 AM, srujan k <srujan.kdas at gmail.com> wrote:

> Hi Devteam,
>
> I am going through the source code of RIP. I am not able to understand how
> the function "rip_interface_wakeup" is filled with interface structure.
>
> There is a call   ifp = THREAD_ARG (t);, after this call ifp is filled
> with interface detail. I am not able to understand how THREAD_ARG is used
> to fill ifp structure.
>
>
> The thread structure has following details.
> * Thread itself. */
> struct thread
> {
>   thread_type type;        /* thread type */
>   thread_type add_type;        /* thread type */
>   struct thread *next;        /* next pointer of the thread */
>   struct thread *prev;        /* previous pointer of the thread */
>   struct thread_master *master;    /* pointer to the struct thread_master.
> */
>   int (*func) (struct thread *); /* event function */
>   void *arg;            /* event argument */
>   union {
>     int val;            /* second argument of the event. */
>     int fd;            /* file descriptor in case of read/write. */
>     struct timeval sands;    /* rest of time sands value. */
>   } u;
>   RUSAGE_T ru;            /* Indepth usage info.  */
>   struct cpu_thread_history *hist; /* cache pointer to cpu_history */
> *  char* funcname;*
> };
>
> Can some one point to me to understand the code flow to start with.
>
> Regards,
> Srujan
>
> _______________________________________________
> Quagga-dev mailing list
> Quagga-dev at lists.quagga.net
> https://lists.quagga.net/mailman/listinfo/quagga-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quagga.net/pipermail/quagga-dev/attachments/20150408/151a1433/attachment-0001.html>


More information about the Quagga-dev mailing list