Cygwin: timerfd: implement fork semantics

- Puzzeling: Commit ec98d19a08
  changed ttstart to NO_COPY but kept all the code to handle
  fixup after fork.  Revert to not-NO_COPY and make timerfd
  fork work.

- On fixup_after_fork, keep timerfd timers and restart thread
  if they were armed in the parent.

- Move timerfd timer_trackers to cygheap.  Overload timer_tracker
  new and delete methods to handle timers accordingly.  This is not
  exactly required for fork, but exec will be grateful.

- Give up on TFD_TIMER_CANCEL_ON_SET for now.  There's no easy way
  to recognize a discontinuous change in a clock.

- Be paranoid when cleaning out ttstart.

- Fix some minor issues.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2019-01-16 15:33:15 +01:00
parent f5808867cf
commit 4195bae67f
4 changed files with 58 additions and 20 deletions

View File

@@ -2699,9 +2699,7 @@ class fhandler_timerfd : public fhandler_base
HANDLE get_timerfd_handle ();
void fixup_after_fork_exec (bool);
void fixup_after_exec () {fixup_after_fork_exec (true);}
void fixup_after_fork (HANDLE) {fixup_after_fork_exec (false);}
void fixup_after_exec ();
select_record *select_read (select_stuff *);
select_record *select_write (select_stuff *);