Commit Graph

3 Commits

Author SHA1 Message Date
Corinna Vinschen 1f10a00ba7 Cygwin: posix timers: fix overrun count always being 1 too big
Combine with a bit of cleanup:
- Drop overrun_event_running in favor of overrun_count being -1.
- Fix include guard in posix_timer.h.
- Drop ununsed function timespec_to_us.
- Don't use Interlocked functions without need.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-22 18:20:18 +01:00
Corinna Vinschen 83c51fffe6 Cygwin: posix timers: allocate timer_tracker on system heap.
Allocating on the cygheap would copy information of the tracker into
the child process.  A forked child knows the timer id and could simply
still access the (free'd but still valid) timer_tracker on the heap,
which is dangerous and very certainly doesn't reflect POSIX semantics.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-22 16:38:14 +01:00
Corinna Vinschen 229ea3f23c Cygwin: posix timers: reimplement using OS timer
- Rename files timer.* to posix_timer.*.
- Reimplement using an OS timer rather than a handcrafted wait loop.
- Use a Slim R/W Lock for synchronization.
- Drop timer chaining.  It doesn't server a purpose since all timers
  are local only.
- Rename ttstart to itimer_tracker to better reflect its purpose.
  It's not the anchor for a timer chain anymore anyway.
- Drop fixup_timers_after_fork.  Everything is process-local, nothing
  gets inherited.
- Rename timer_tracker::disarm_event to disarm_overrun_event for
  better readability.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-22 15:23:05 +01:00