merge revision(s) 39687,39776,40438: [Backport #8064]

	* io.c (rb_update_max_fd): use ATOMIC_CAS because this function
	  is used from timer thread too.

	* io.c (rb_fd_fix_cloexec): use rb_update_max_fd().


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