Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: rsalz@osf.org (Rich Salz)
Subject: Re: errno and DCE and threads
Date: 9 Nov 1994 13:27:05 GMT	[thread overview]
Message-ID: <39qin9$9g6@paperboy.osf.org> (raw)
In-Reply-To: 39lsjk$lrf@clam.hi.com

In article <39lsjk$lrf@clam.hi.com> wright@clam.hi.com (David Wright) writes:
>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).

If you read the definition of errno in the ANSI standard, you'll see that
errno can be a #define that evaluates to an lvalue.  This means you
can do things like this:
    /* Returns the address of the per-thread "errno" field in the current
     * thread.  Assumes each thread has an internal state struct. */
    extern int *pthread_errno_np(void);

    #define errno  (*pthread_errno_np())

In practice, however, it's probably easier to just store errno in the internal
per-thread state block and copy it in/out as part of your thread task
context switch.

For kernel threads, the kernel should just be doing the right thing.
	/r$


  parent reply	other threads:[~1994-11-09 13:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-07 18:45 errno and DCE and threads David Wright
1994-11-07 20:14 ` Alan Lehotsky
1994-11-08 15:42 ` Andrew Hastings
1994-11-08 21:35   ` Simon Patience
1994-11-09 20:05     ` Andrew Hastings
1994-11-09 13:27 ` Rich Salz [this message]
1994-11-15 10:14   ` Casper H.S. Dik
1994-11-15 16:38     ` Rich Salz
1994-11-15 21:19       ` Casper H.S. Dik
1994-11-15 21:40       ` Alan Lehotsky
1994-11-15 22:09     ` Spike White
1994-11-17 17:09       ` Alan Deehr
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