[omniORB] Re: How to do a timeout (with oO but independent of it)?

Pfeiffer Daniel Daniel.Pfeiffer@start.de
Tue Sep 3 14:09:01 2002


Sorry for reposting, but while this appears in the archives, I didn't get it in my daily digest.  And the question is very important!

Pfeiffer Daniel <Daniel.Pfeiffer@start.de> skribis:
> I've got a case where our business logic dictates that if a certain
> method gets called, another one must also get called shortly afterwards.

> So, on method entry, when I've got a timer running, I do

> 	alarm( 0 );

> and at the end of the special method I do

> 	signal( SIGALRM, timeout_handler );
> 	alarm( 20 );

> In a debugger (kdbg) I've had my timeout_handler get called, but when
> running normally it never does.  I'm also amazed at not seeing anything
> with strace -e signal when coming by this point (which I definitely come
> by).  I suppose this is at odds with threads or other signal handling in
> omniORB.

Ok., I've solved the mystery part.  Since Linux doesn't have real threads I have to call strace with -f.  So I see:

[pid  1314] rt_sigaction(SIGALRM, {0x401439a8, [ALRM], SA_RESTART|0x4000000}, {0x401439a8, [ALRM], SA_RESTART|0x4000000}, 8) = 0
[pid  1314] alarm(5)                    = 0

But the signal never arrives, not in any thread.  So my question still remains: How do I implement a timeout?

Btw. if no more messages arrive, the server continues and endlessly does the following last 3 lines.

[pid  1298] --- SIGRT_1 (Real-time signal 1) ---
[pid  1298] sigreturn()                 = ? (mask now ~[TRAP KILL STOP])
[pid  1300] rt_sigprocmask(SIG_SETMASK, [RTMIN], NULL, 8) = 0
[pid  1300] rt_sigprocmask(SIG_BLOCK, NULL, [RTMIN], 8) = 0
[pid  1300] rt_sigprocmask(SIG_UNBLOCK, [RTMIN], [RTMIN], 8) = 0

best regards
Daniel

-- 
 -- http://dapfy.bei.t-online.de/sawfish/
  -- KDE menu, smooth viewport scrolling, pager, window-snooper