That would work.

Does --semaphoretimeout 0 mean never give up?

If so then -0 could mean give up immediately.

By the way the note on the sem man page says that sem --timeout is not
implemented.

       --timeout secs (not implemented)
       -t secs (not implemented)
                If the semaphore is not released within secs seconds, take
itanyway.

And indeed testing of (parallel --version \n GNU parallel 20141022)
indicate that it does not work. Anyway great product, thanks Ole.

Bradley

On Fri, Jan 2, 2015 at 7:35 AM, Ole Tange <o...@tange.dk> wrote:

> On Fri, Jan 2, 2015 at 10:51 AM, Bradley Asztalos
> <b...@customweather.com> wrote:
>
> > Taking this one step further, I know of course there are other ways to do
> > this, but what about a way to have sem die if it cannot immediately
> acquire
> > execute? Something like --die_young so that it could be used not only to
> > serialize but to disallow a run if there is already a process running
> with
> > the same lock_id.
>
> So that is almost the opposite of --semaphoretimeout
>
> Maybe it should be able to take a negative value: If you cannot get
> the semaphore within 2 seconds, give up.
>
> sem --semaphoretimeout -2 do_stuff
>
>
> /Ole
>

Reply via email to