Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: lehotsky@max.tiac.net (Alan Lehotsky)
Subject: Re: More on threads and errno
Date: 17 Nov 1994 20:17:29 GMT	[thread overview]
Message-ID: <3agdop$i2a@sundog.tiac.net> (raw)
In-Reply-To: 3ag928$47n@clam.hi.com

In article <3ag928$47n@clam.hi.com>, David Wright <wright@clam.hi.com> wrote:
>
>
>	Trying to maintain locks around this data will be a thankless
>	chore.
>
>Interestingly, the OSF/1 solution was to modify libc (creating libc_r)
>to do exactly this; for example, the stdio functions had locking
>introduced into them.


	I knew that.  I was trying to say that managing the locks
	_outside_ of the library will be unacceptable.

>
>Now, let me tell you what we're proposing to do.  We'll add a pair of
>wrapper functions, say ENTER() and EXIT() (not their real names), that
>are invoked as follows:
>
>     ENTER();
>     non_thread_safe_function();
>     EXIT();
>
...
>  -- David Wright, Hitachi Computer Products (America), Inc.  Waltham, MA
>     wright@hi.com  ::  DCE Project Leader


Here's a shot across the bow.... :-)

	Other DCE vendors have fixed their libraries to be
	thread-safe.  Thus, DCE application code is

		- widely portable to other DCE implementations.

		- integratable into an existing application without
		  having to wrap each non-thread-safe function.

	Now, as a technique for dealing with 3rd party libraries where you
	can't recompile, this is probably okay.

That didn't slow you down?

	How about the fact that the existing __errno() function is
	invariant, it merely returns a lvalue for a 'slot' in the
	per-thread data area.  Your suggestion has to double indirect
	(e.g., the ENTER() and EXIT() guards have to change what
	__errno() returns.)

Finally, for the errno problem, since only system calls should be
setting errno, there shouldn't be any third party libraries that
aren't obeying the rules of accessing via the errno selector function.

-- Al Lehotsky
======================================================================
			Quality Software Management
			      8 Tucker Ave.
			   Lexington, MA 02173

   lehotsky@tiac.net	Voice: (617)862-5418	Fax: (617)674-1096

	   Software Process Improvement and Management Consulting





      reply	other threads:[~1994-11-17 20:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-17 18:57 More on threads and errno David Wright
1994-11-17 20:17 ` Alan Lehotsky [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox