From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,8e9b885446835ab4,start X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1994-11-07 14:11:23 PST Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!news2.near.net!sunfish.hi.com!clam.hi.com!not-for-mail From: wright@clam.hi.com (David Wright) Newsgroups: comp.unix.osf.misc Subject: errno and DCE and threads Date: 7 Nov 1994 13:45:08 -0500 Organization: Hitachi Computer Products (America), Inc. Distribution: world Message-ID: <39lsjk$lrf@clam.hi.com> NNTP-Posting-Host: clam.hi.com We're running into some real problems with productizing DCE when it comes to dealing with other, non-DCE, libraries. (This is on an OSF/1 base, BTW.) The single biggest problem is errno handling. Errno is a single, global variable in standard Unix. (Granted, this was a really bad design decision, but we're stuck with it.) Since DCE applications are multi-threaded, they need to be able to keep errno on a per-thread basis (so they don't trip over each other's values). Within DCE itself, this is not a big deal. You can redefine errno to be a function that points to a per-thread data item. The problem arises when you try to link against other libraries (libX, let's say, or libm) that still use the global variable. Actually, there are two problems. One is that multiple threads might try to call a non-thread-safe function that sets errno. This you can presumably handle within your application by doing your own locking. The other problem lies in communicating errno values between threaded and non-threaded code. We've come up with some possible solutions for this problem, but before we do anything rash, we wondered if anyone out there could tell us what other vendors have done. -- David Wright, Hitachi Computer Products (America), Inc. Waltham, MA wright@hi.com :: DCE Project Leader