[Xorp-hackers] waiting for a callback return

Selçuk Cevher cevhers at gmail.com
Tue Jul 1 11:50:09 PDT 2008


Hi All,

I want to call an xrl method of a process X in the middle of a function
defined in some other process Y.

The callback function defined in Y which processes the values returned by X
simply sets a boolean variable VAR to TRUE if the value of XrlError object
is OKAY.

Below is how I called the xrl method of process X in Y, and wait for the
callback to return:

            send_request(argument_list);

            while(!VAR)
            {
                // Do nothing
            }

            //  When VAR becomes true, do something

where send_request(argument_list) is a local function in Y which calls
the xrl method in the client interface of process X till the request has
been successfully sent (As expected, it also sends across the name of the
callback function in Y).

VAR is set to TRUE when the callback in Y is called with an argument of
XrlError::OKAY.

However, waiting in a while loop for VAR to become TRUE through the callback
in Y even prevents the xrl_method handler in process X from being called.
Hence, the while loop above turns into an infinite loop since VAR will never
be set to TRUE by the callback in Y.

What is the proper way other than a while loop like above for waiting for
VAR to become true ?

Thanks,
Selcuk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/xorp-hackers/attachments/20080701/21cc42be/attachment.html 


More information about the Xorp-hackers mailing list