From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,4753a27d8ceddc44 X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1993-02-16 15:14:12 PST Newsgroups: comp.unix.osf.misc Path: sparky!uunet!UB.com!pacbell.com!network.ucsd.edu!usc!howland.reston.ans.net!gatech!darwin.sura.net!haven.umd.edu!decuac!pa.dec.com!engage.pko.dec.com!nntpd.lkg.dec.com!ktbush.ogo.dec.com!mjg From: mjg@ktbush.ogo.dec.com (Michael J. Grier) Subject: Re: Thread-safe libraries for C++? Message-ID: <1993Feb16.231412.21635@nntpd.lkg.dec.com> Sender: usenet@nntpd.lkg.dec.com (USENET News System) Reply-To: mjg@ktbush.ogo.dec.com (Michael J. Grier) Organization: Digital Equipment Corporation References: <1993Feb12.204022.25188@nntpd.lkg.dec.com> <1993Feb16.175330.11699@mdivax1.uucp> Date: Tue, 16 Feb 1993 23:14:12 GMT In article <1993Feb16.175330.11699@mdivax1.uucp>, robinson@mdivax1.uucp (Jim Robinson) writes: |>Michael J. Grier (mjg@ktbush.ogo.dec.com) wrote: |>> It means that there is liberal use of #define to change your invocation |>>of standard library functions to instead call the DCE jacket, which is |>>a function which will perform the work behind your back to ensure that the |>>operation is carried out in a thread-safe manner. |> |>[and] |> |>> For some operations, the jackets go farther to give you some semblance of |>>thread-synchronous operation, for example select(). Your mileage will |>>vary depending on your UNIX variant and how serious its kernel is about not |>>blocking when non-blocking I/O is requested. |> |>Is it correct to say then that if one forgets to #include the relevant |>header the result is that the native select() is used which could block |>the entire process instead of just the calling thread? Is so, isn't this |>an incredibly easy mistake to make which may not be terribly easy to |>catch? You can work around it in a given project by having one of your central h files #include the relevant definitions. That's how we handle it, and it usually works out OK. Depending on your environment, it may be very easy to catch -- you'll hang! ;-) In a situation where a blocking I/O doesn't block for long, you'll just get degraded performance. Since followups were redirected to comp.unix.osf.misc, I assume we're talking in the context of OSF/1, so with kernel support for threads, things may be different. There are different models of how pthreads threads map onto OSF/1 kernel threads, so it depends upon the mapping chosen. If threads always map one-to-one to kernel threads, I believe that you will not have a problem. If the mapping is not one-to-one, you can/will get one of the kernel threads hung in a select() or other blocking I/O call. |> |>And, are the jacket routines also used to map blocking I/O calls (e.g. |>read(), recvfrom()) to non-blocking versions? |> Yes. It's true of any call which blocks the running thread while in the kernel. |>[Followup to comp.unix.osf.misc only] |>-- |>Jim Robinson |>robinson@mdd.comm.mot.com |>{ubc-cs!van-bc,uunet}!mdivax1!robinson |> |> ------------------------------------------------------------------------ I'm saying this, not Digital. Don't hold them responsibile for it! Michael J. Grier Digital Equipment Corporation (508) 496-8417 mjg@ktbush.ogo.dec.com Stow, Mass, USA Mailstop OGO1-1/E16