From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,3ea3751944fb5801 X-Google-Attributes: gidfee84,public From: spider@Orb.Nashua.NH.US (Spider Boardman) Subject: Re: Threads Date: 1995/04/06 Message-ID: #1/1 X-Deja-AN: 100926838 references: <3lpjq8$r07@bcarh8ab.bnr.ca> organization: Duchy of Wabesylvan Obspauk newsgroups: comp.unix.osf.osf1 In article <3lpjq8$r07@bcarh8ab.bnr.ca> danr@bnr.ca (Dan Reynolds) writes: Dan> To obtain thread safe code one must remove or protect references to the Dan> following dependencies: Dan> o REFERENCES TO GLOBAL ERRNO Dan> The problem is that the GLOBAL ERRNO is used by many UNIX Dan> functions, such as file I/O, sockets, semaphores, etc..., Dan> and even the PTHREAD library. Umm, look again. If you read through errno.h, you'll some #if's for threaded code. It turns out that, for threaded code, errno is a macro, and the real error number value is in a per-thread data area. Just be sure you built your threaded code correctly. Use something like this: cc ${CFLAGS} -c ${SRCS} -threads The main thing this does for .o files is add -D_REENTRANT to the flags passed to cfe. For final linking, though: cc ${LDFLAGS} -o $@ ${OBJS} ${LIBS} -threads That's where the rest of the magic (to use the right libraries) happens. It can (and will) change from release to release, so don't fake it out. -- Spider Boardman (at home) spider@Orb.Nashua.NH.US The management (my cats) made me say this ...!decvax!orb!spider