XtAppAddTimeOut question - Motif

This is a discussion on XtAppAddTimeOut question - Motif ; Hi, I am new to motif and working on some legacy code like this: main_loop(Widget w, XtPointer data) { foo(); XtAppAddTimeOut(appCtx, TimeOutInterval,(XtTimerCallbackProc) main_loop, NULL); } Questions: 1. Is the XtAppAddTimeOut() call blocking? When waiting for the timeout, is the calling ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: XtAppAddTimeOut question

  1. XtAppAddTimeOut question

    Hi,

    I am new to motif and working on some legacy code like this:

    main_loop(Widget w, XtPointer data)
    {
    foo();

    XtAppAddTimeOut(appCtx, TimeOutInterval,(XtTimerCallbackProc) main_loop,
    NULL);
    }

    Questions:
    1. Is the XtAppAddTimeOut() call blocking? When waiting for the timeout, is the calling main_loop() blocked?

    2. Notice the call back function is also main_loop(), does this mean recursive call for main_loop()? Would this create a long main_loop() call stack and eventually overflow the stack?

    Thanks very much

  2. Re: XtAppAddTimeOut question

    Quote Originally Posted by bmeson View Post
    Hi,

    I am new to motif and working on some legacy code like this:

    main_loop(Widget w, XtPointer data)
    {
    foo();

    XtAppAddTimeOut(appCtx, TimeOutInterval,(XtTimerCallbackProc) main_loop,
    NULL);
    }

    Questions:
    1. Is the XtAppAddTimeOut() call blocking? When waiting for the timeout, is the calling main_loop() blocked?

    2. Notice the call back function is also main_loop(), does this mean recursive call for main_loop()? Would this create a long main_loop() call stack and eventually overflow the stack?

    Thanks very much
    1. No main_loop() will not be blocked.
    2. Yes this does mean recursive calling, but there woudn't be any overflows, it's just calling the main_loop() consequently when the time goes out, you'll be able to call main_loop() externally while the timer is waiting.

    See you.

+ Reply to Thread