[haiku-bugs] [Haiku] #9771: _single_threaded not updated in case of SIGEV_THREAD

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Wed, 15 May 2013 13:10:11 -0000

#9771: _single_threaded not updated in case of SIGEV_THREAD
-------------------------------+------------------------------
 Reporter:  bonefish           |        Owner:  axeld
     Type:  bug                |       Status:  new
 Priority:  normal             |    Milestone:  R1
Component:  System/libroot.so  |      Version:  R1/Development
 Keywords:                     |   Blocked By:
 Blocking:                     |  Has a Patch:  0
 Platform:  All                |
-------------------------------+------------------------------
 libroot's `_single_threaded` global variable (<stdio_post.h>) is only
 updated in `spawn_thread()`. A `SIGEV_THREAD` signal handler will also
 create a thread, but the variable won't be set in that case, since it is
 only done in `spawn_thread()`. By the time the thread has been created, it
 may be too late to set the flag, since the main thread may already be in
 the middle of a libroot function that requires locking in a multi-threaded
 program, so it is probably best to set the variable already when the
 signal handler is set.

 A similar problem (without solution) exists when a thread is created in a
 signal handler function.

 It should also be considered to alias `{getc,putc}_unlocked()` with the
 locking version and omit the variable (save for keeping the storage for
 binary compatibility).

--
Ticket URL: <http://dev.haiku-os.org/ticket/9771>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: