• 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
write(2)/writev(2) atomicity?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

write(2)/writev(2) atomicity?


  • Subject: write(2)/writev(2) atomicity?
  • From: email@hidden
  • Date: Tue, 8 Nov 2005 14:11:05 +0100

Hi All,

in a multi-threaded terminal application I use writev(2) to write status
messages to stderr (for testing purposes an xterm), however although the
complete message is written with a single call to writev (and now I also
tested write, with the same effect), and in the tested case the length of
the message was well below PIPE_BUF, the output of the different threads
is sometimes interleaved (always starting at 40 bytes into a message,
i.e. 40 bytes of the first message, and then another message, then the
rest of the first message).

I am pretty sure that all standards require at least write(2) to be
async-signal-safe, and to write messages smaller than PIPE_BUF
atomically ... does anyone know more about this on Darwin?

(Including pointers to more documentation about thread safety of the
kernel and libc functions; only very few like getaddrinfo(3) seem to
have notes on this subject (and in that case stating only that it is
_not_ thread safe, contrary to POSIX) in their man-page.)

Thanks, Colin


PS: 10.4.3 on a Mac mini.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: locale and UTF-8
  • Next by Date: Re: 64-bit question
  • Previous by thread: Re: Source code for libSystem.B.dylib?
  • Next by thread: pthreads and CF runloops (possibly slightly OT)
  • Index(es):
    • Date
    • Thread