Unix Programming - unexpected semtimedop(2) timeout behavior

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > October 2005 > unexpected semtimedop(2) timeout behavior





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author unexpected semtimedop(2) timeout behavior
Michael B Allen

2005-10-24, 3:47 pm

I've noticed a disappointing thing about semtimedop(2). Consider the
following scenario:

time
0s process 1 calls semtimedop with a timeout of 10s
7s process 2 calls semtimedop with a timeout of 10s
17s both process 1 & 2 timeout

So if you call semtimedop with a second process on the same semaphore,
it resets the timeout specified by the first caller. What I would like
to happen is:

time
0s process 1 calls semtimedop with a timeout of 10s
7s process 2 calls semtimedop with a timeout of 10s
10s process 1 timeout
17s process 2 timeout

At least this is what I'm seeing with Linux 2.6.11.

Can someone recommend a good workaround?

Thanks,
Mike

Michael Kerrisk

2005-10-24, 3:47 pm

On Sun, 16 Oct 2005 02:37:39 -0400, Michael B Allen
<mba2000@ioplex.com> wrote:

>I've noticed a disappointing thing about semtimedop(2). Consider the
>following scenario:
>
> time
> 0s process 1 calls semtimedop with a timeout of 10s
> 7s process 2 calls semtimedop with a timeout of 10s
> 17s both process 1 & 2 timeout
>
>So if you call semtimedop with a second process on the same semaphore,
>it resets the timeout specified by the first caller. What I would like
>to happen is:
>
> time
> 0s process 1 calls semtimedop with a timeout of 10s
> 7s process 2 calls semtimedop with a timeout of 10s
> 10s process 1 timeout
> 17s process 2 timeout
>
>At least this is what I'm seeing with Linux 2.6.11.
>
>Can someone recommend a good workaround?


Mike,

(On Linux 2.6.14-rc4) I do not see this behaviour (and I wouldn't
expect to). Maybe there is a problem with your test program? If you
think otherwise, perhaps post a small program that demonstrates what
you are seeing?

Cheers,

Michael
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com