merge revision(s) 39680,39681: [Backport #8063]

	* thread_pthread.c (USE_SLEEPY_TIMER_THREAD): use more accurate
	  ifdef condtions.

	* thread_pthread.c (timer_thread_sleep): use poll() instead of
	  select(). select doesn't work if timer_thread_pipe[0] is
	  greater than FD_SETSIZE.

	* thread_pthread.c (USE_SLEEPY_TIMER_THREAD): add a dependency
	  against poll.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 39679,39682,39683,39685,39686,39694: [Backport #7999]

	* thread_pthread.c (set_nonblock): new helper function for set
	  O_NONBLOCK.

	* thread_pthread.c (rb_thread_create_timer_thread): set O_NONBLOCK
	  to timer_thread_pipe[0] too.

	* thread_pthread.c (consume_communication_pipe): retry when
	  read returned CCP_READ_BUFF_SIZE.

	* thread_pthread.c (rb_thread_create_timer_thread): factor out
	  creating communication pipe logic into separate function.

	* thread_pthread.c (setup_communication_pipe): new helper function.

	* thread_pthread.c (set_nonblock): moves a definition before
	  setup_communication_pipe.

	* thread_pthread.c (rb_thread_wakeup_timer_thread_fd): add fd
	  argument and remove hardcoded dependency of timer_thread_pipe[1].

	* thread_pthread.c (consume_communication_pipe): add fd argument.

	* thread_pthread.c (close_communication_pipe): ditto.

	* thread_pthread.c (timer_thread_sleep): adjust the above changes.

	* thread_pthread.c (setup_communication_pipe_internal): factor
	  out pipe initialize logic.

	* thread_pthread.c (ARRAY_SIZE): new.

	* thread_pthread.c (gvl_acquire_common): use low priority
	  notification for avoiding timer thread interval confusion.
	  If we use timer_thread_pipe[1], every gvl_yield() request
	  one more gvl_yield(). It lead to thread starvation.
	  [Bug #7999] [ruby-core:53095]

	* thread_pthread.c (rb_reserved_fd_p): adds timer_thread_pipe_low
	  to reserved fds.

	* process.c (setup_communication_pipe): remove unused function.
	  it was unintentionally added r39683.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e