Commit a23e6a35d896a075640db714b28ce74bb6b8d7ff introduced a timer object to the WFMO handling in select_stuff::wait to allow sub-tickcount timeout values in select. Problems with this patch: The timer was created and destroyed on every invocation of select_stuff::wait, thus potentially multiple times per select. Also, since the timer was prepended to the WFMO hande list, the timer handle could shadow actual events on other objects, given that WFMO checks the objects in the order they have been specified in the HANDLE array. The timer was also created/destroyed and added to the HANDLE array even if it was not required. This patch drops the local timer HANDLE and recycles the cw_timer HANDLE in the cygtls area instead. Thus we typically don't need to create the timer in select at all, and we never have to destroy it. The timer HANDLE is now also appended as last object to the HANDLE array, and it's only added if actually needed. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cygwin documentation is available on the net at https://cygwin.com You might especially be interested in https://cygwin.com/faq/faq.html#faq.programming.building-cygwin