freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Lowden, James K" <LowdenJK AT bernstein.com>
- To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
- Subject: RE: asprintf vasprintf
- Date: Thu, 29 Aug 2002 13:00:53 -0400
> From: Brian Bruns [mailto:camber AT ais.org]
> Sent: August 29, 2002 12:42 PM
>
> can someone give me a quick summary on this?
OK, but quick isn't my forte. :)
> I'd rather not have any thread primitives in the
> library if we can avoid it even if it does mean implementing
> our own on
> those platforms that don't have a suitable reentrant function.
No one's added any threading code per se that I know of.
> And if we
> have suitable functions on different platforms (Tru64 has X,
> linux has Y, HP/UX has Z) can we wrap them and use autoconf to test?
That's what we do.
Basically, there was one call to vsnprintf(); it supported dbfcmd(). Nick
looked at it, decided what was really needed was vasprintf(). He sent it in
as PD. I added it, wrapping the body of the .c in #if !HAVE_VASPRINTF, so
the module is effectively empty if the OS provides an implementation.
Nick's implementation relied on writing to a too-small buffer, trapping
SIGSEGV, extending the buffer as needed. Works single threaded, very nice,
a joy to behold. Multithreaded, though, could cause a problem because of a
race condition:
1. enter vasprintf.
2. install signal handler, prepare to write to buffer.
3. other thread faults.
4. vasprintf handler does something stupid.
5. bad things happen.
Nick's long mail details why there's no good way for a library to deal with
signal handling in threaded environments. So goes the war. He is
re-implementing the function such that it doesn't rely on signals.
--jkl
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that for certain accounts we do not accept
orders and/or instructions by e-mail, and for those accounts we will not be
responsible for carrying out such orders and/or instructions. Kindly refrain
from sending orders or instructions by e-mail unless you have confirmed that
we accept such communications for your account. Please also note that to
satisfy regulatory requirements we review the outgoing and incoming e-mail
correspondence of staff members serving certain functions.
-
RE: asprintf vasprintf
, (continued)
- RE: asprintf vasprintf, Castellano, Nicholas, 08/28/2002
- RE: asprintf vasprintf, Castellano, Nicholas, 08/29/2002
- RE: asprintf vasprintf, ZIGLIO Frediano, 08/29/2002
- RE: asprintf vasprintf, Castellano, Nicholas, 08/29/2002
- RE: asprintf vasprintf, Lowden, James K, 08/29/2002
- RE: asprintf vasprintf, Castellano, Nicholas, 08/29/2002
- RE: asprintf vasprintf, ZIGLIO Frediano, 08/29/2002
- RE: asprintf vasprintf, Bernd Jendrissek, 08/29/2002
- RE: asprintf vasprintf, Brian Bruns, 08/29/2002
- RE: asprintf vasprintf, Castellano, Nicholas, 08/29/2002
- RE: asprintf vasprintf, Lowden, James K, 08/29/2002
- RE: asprintf vasprintf, Castellano, Nicholas, 08/29/2002
- RE: asprintf vasprintf, Brian Bruns, 08/29/2002
- RE: asprintf vasprintf, Castellano, Nicholas, 08/29/2002
Archive powered by MHonArc 2.6.24.