From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,239b910cab54fd83 X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1994-11-17 17:28:32 PST Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!news.sprintlink.net!sundog.tiac.net!max.tiac.net!lehotsky From: lehotsky@max.tiac.net (Alan Lehotsky) Newsgroups: comp.unix.osf.misc Subject: Re: More on threads and errno Date: 17 Nov 1994 20:17:29 GMT Organization: The Internet Access Company Message-ID: <3agdop$i2a@sundog.tiac.net> References: <3ag928$47n@clam.hi.com> NNTP-Posting-Host: max.tiac.net In article <3ag928$47n@clam.hi.com>, David Wright 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