Unix Programming - semtimedop portability?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > August 2005 > semtimedop portability?





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 semtimedop portability?
Michael B Allen

2005-07-29, 6:01 pm

How portable is semtimedop(2)? I know Linux and HPUX has it. Is there a
standard way to wait on a Sys V semaphore for no longer than a specified
timeout?

Thanks,
Mike

Michael Kerrisk

2005-08-01, 2:55 am

On Fri, 29 Jul 2005 15:33:11 -0400, Michael B Allen
<mba2000@ioplex.com> wrote:

>How portable is semtimedop(2)? I know Linux and HPUX has it. Is there a
>standard way to wait on a Sys V semaphore for no longer than a specified
>timeout?


Hi Mike,

It isn't widely available (not in POSIX.1-2001). Solaris 9 has it.
(I didn't know that HP-UX had it... are you sure? Which version of
HP-UX?)

The portable way of doing thingsis to set a timer before semop() using
alarm() or setitimer().

Cheers,

Michael
Michael B Allen

2005-08-03, 6:00 pm

On Mon, 01 Aug 2005 10:27:36 +0200, Michael Kerrisk wrote:

> On Fri, 29 Jul 2005 15:33:11 -0400, Michael B Allen
> <mba2000@ioplex.com> wrote:
>
>
> Hi Mike,
>
> It isn't widely available (not in POSIX.1-2001). Solaris 9 has it.
> (I didn't know that HP-UX had it... are you sure? Which version of
> HP-UX?)


No but I found hp docs about it [1] while googling.

> The portable way of doing thingsis to set a timer before semop() using
> alarm() or setitimer().


I don't particularly like signals for this sort of thing - it's like
wacking someone over the head with a rubber mallet just to get their
attention. But I suppose I will do what I have to do. I guess in my
current case it would not be too bad to use a signal because the timeout
shouldn't happen too frequently.

Thanks,
Mike

[1] http://docs.hp.com/en/B2355-60103/semop.2.html

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com