This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
The attached patch implements the alarm, ualarm, setitimer and
getitimer with the timer_xxx calls created by Chris last year.
It has two objectives, both motivated by exim.
- The current implementation of alarm() opens a hidden window.
Thus, on Win9X, services calling alarm do not survive user logouts.
- When running exim as a service under a privileged (non system)
account on XP (trying out what's necessary on Win2003), I have hit
api_fatal ("couldn't create window, %E") with error 5.
The implementation of getitimer has necessitated the development
of timer_gettime (not yet exported) and some changes to the logic
of the timer_thread. I have also fixed a FIXME about race condition
and two bugs:
- the initial code was not reusing the cygthreads (see attachment).
The fix involves using "auto_release" in the timer thread instead of
"detach" in the calling function.
- the mu_to was not reinitialized on forks (non-inheritable event).
Pierre
2005-03-05 Pierre Humblet <pierre.humblet@ieee.org>
* window.cc (getitimer): Delete.
(setitimer): Ditto.
(ualarm): Ditto.
(alarm): Ditto.
* timer.cc (struct timetracker): Delete it, flags and a creator.
Add it_interval, interval_us, sleepto_us, running, init_muto(),
and gettime().
(timer_tracker::timer_tracker): Create event. Distinguish ttstart case.
(timer_tracker::init_muto): New method.
(to_us): Round up as per POSIX.
(timer_thread): Reorganize to match timer_tracker::settime and
timer_tracker::gettime. Call sig_send without wait. Call th->auto_release.
(timer_tracker::settime): Reorganize logic to avoid race.
Call gettime to recover old value. Do not call th->detach.
(timer_tracker::gettime): New method.
(timer_gettime): New function.
(timer_delete): Stop the timer_thread, clear magic and close the event.
(fixup_timers_after_fork): Reinit ttstart and the mu_to.
(getitimer): New implementation.
(setitimer): Ditto.
(ualarm): Ditto.
(alarm): Ditto.Attachment:
timer.diff
Description: Text document
Attachment:
timer_trace.txt
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |