• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: possibly OT: threadsafe libc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: possibly OT: threadsafe libc


  • Subject: RE: possibly OT: threadsafe libc
  • From: Philip Lukidis <email@hidden>
  • Date: Mon, 21 Nov 2005 13:20:03 -0500

Thanks, that's pretty clear.

Philip Lukidis

> -----Original Message-----
> From: Damien Bobillot [mailto:email@hidden]
> Sent: Monday, November 21, 2005 1:03 PM
> To: Philip Lukidis
> Cc: email@hidden
> Subject: Re: possibly OT: threadsafe libc
>
>
>
> Philip Lukidis wrote :
>
> > Hello.  I was wondering if there was a fully threadsafe libc
> > version which I
> > can use.  I'll be using pthreads and was hoping there would be an
> > easy way
> > to know which libraries are threadsafe or not.
> >
> > Does Apple formally specify which functions in libc are
> > threadsafe?  I have
> > heard that several libc functions have a _r version, but
> was hoping
> > that
> > there would be a fully threadsafe library which I can link
> to.  For
> > example,
> > sprintf does not have a _r version...does that mean I have to wrap
> > sprintf
> > calls with a mutex?  I would assume not, but this would be my
> > intuition
> > speaking and not a formal written declaration by Apple on which
> > libraries/calls are threadsafe.
>
> As said Eric, the Mac OS X libSystem is thread safe with the
> following definition of thread safe : a function which uses a static
> thread buffer (one static buffer for each thread) instead of a
> process wide static buffer (like old implementations of
> gethostbyname).
>
> If you share a char pointer between two threads, the libc
> doesn't use
> mutexes to avoid simultaneous access by both threads. However, you
> may use the "string" class from the C++ STL, which IIRC is fully
> thread safe.
>
> --
> Damien Bobillot
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Target setup for unit testing (using cppunit)
  • Next by Date: Re: Xcode 2.2: /usr/bin/ld: Undefined symbols: __Unwind_Resume
  • Previous by thread: RE: possibly OT: threadsafe libc
  • Next by thread: lazy symbol binding failed
  • Index(es):
    • Date
    • Thread