Re: pause/resume timer



On Mon, 20 Oct 2003, Johannes [utf-8] WeiÃ?l wrote:

Hello,

is it possible to pause/resume a started GTimer?!
If not, is there a portable (the program should
run on Windows and Linux) solution for this problem?

Timers is a very operating system dependent thing.

Layers above the operating system tries to give a uniform
access to some concepts.

If you look at setitmer in FreeBSD and Linux there is some
subtile differenses.

man setitimer

---< FreeBSD >----

  If it_value is non-zero, it indicates the time to the next timer expira-
  tion.  If it_interval is non-zero, it specifies a value to be used in
  reloading it_value when the timer expires.  Setting it_value to 0
  disables a timer, regardless of the value of it_interval.  Setting
  it_interval to 0 causes a timer to be disabled after its next expiration
  (assuming it_value is non-zero).

---< Linux >----

  Timers decrement from it_value to zero, generate a signal,
  and  reset  to  it_interval.  A timer which is set to zero
  (it_value is zero or the timer expires and it_interval  is
  zero) stops.

-----

In FreeBSD the timer is "disabled" and in Linux it "stops". Is this
the same thing as beeing restartable? You have to experiment! And
look carefully for the kernel version.

Windows - forgetit!

Try the following code on Windows

---<This will kill windows!>---

int *pointer;

  while(1)
    pointer = malloc(10000);

----

So forget about timers there... ;-)

Göran Hasse

----------------------------------------------------------------
Göran Hasse            email: gh raditex se     Tel: 08-6949270
Raditex AB             http://www.raditex.se    Fax: 08-4420570
Sickla Alle 7, 1tr                              Mob: 070-5530148
131 34  NACKA, SWEDEN






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]