bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Console client plug-in options


From: Jeroen Dekkers
Subject: Re: Console client plug-in options
Date: Fri, 8 Aug 2003 21:58:47 +0200
User-agent: Mutt/1.5.4i

On Fri, Aug 08, 2003 at 07:55:51PM +0200, Marcus Brinkmann wrote:
> On Fri, Aug 08, 2003 at 02:06:13PM +0200, Jeroen Dekkers wrote:
> > On Thu, Aug 07, 2003 at 11:48:41PM +0200, Marco Gerards wrote:
> > > Already tried to use an argp parser, and that worked. Unfortunately
> > > there were issues with the argp parser, argp isn't reentrant. (I guess
> > > I was lucky when I used it).
> > 
> > Hmm, I don't see a reason why this wouldn't work. The problem is when
> > different threads use argp at the same time, but this can't happen
> > with the locks protecting argp. These locks are recursive, recursively
> > calling argp doesn't cause a deadlock.
> 
> The comment in argp-parse.c is:
> 
>    If we can, we regulate access to getopt, which is non-reentrant, with a
>    mutex.  Since the case we're trying to guard against is two different
>    threads interfering, and it's possible that someone might want to call
>    argp_parse recursively (they're careful), we use a recursive lock if
>    possible. 
>  
> I wonder what this "they're careful" means.

I read that comment. The only thing I can find is that opterr can be
changed by a recursive call to argp, this is easy to fix by setting
opterr to the right value before every call to getopt. I don't see any
other problems. We just have to be careful not to use different
ARGP_NO_ERRS settings at the moment.

Jeroen Dekkers




reply via email to

[Prev in Thread] Current Thread [Next in Thread]