Re: Thread-safe getopt() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Thread-safe getopt()
Date
Msg-id 2007091.1774881280@sss.pgh.pa.us
Whole thread Raw
In response to Re: Thread-safe getopt()  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: Thread-safe getopt()
List pgsql-hackers
Heikki Linnakangas <hlinnaka@iki.fi> writes:
>>> Here's a patch for a thread-safe version of getopt(). I implemented it 
>>> as two functions, pg_getopt_start() and pg_getopt_next(). Since 
>>> there's no standard to follow, we have freedom on how to implement it, 

Why in the world would we invent our own getopt API rather than
just replacing the relevant state variables with thread-local ones,
entirely internally to getopt.c?

It's not like this is a performance-critical code path.  I think
the cognitive load for developers of having to learn YA API should
weigh against doing things this way.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Thread-safe getopt()
Next
From: "David G. Johnston"
Date:
Subject: Re: [PATCH] Add support for INSERT ... SET syntax