commit-hurd
[Top][All Lists]
Advanced

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

gnumach/oskit/pc osenv_bell.c


From: Roland McGrath
Subject: gnumach/oskit/pc osenv_bell.c
Date: Tue, 05 Nov 2002 19:52:36 -0500

CVSROOT:        /cvsroot/hurd
Module name:    gnumach
Changes by:     Roland McGrath <address@hidden> 02/11/05 19:52:36

Modified files:
        oskit/pc       : osenv_bell.c 

Log message:
        2002-11-05  Roland McGrath  <address@hidden>
        
        * oskit/pc/osenv_bell.c (direct_cons_bell): Use a private timer
        instead of calling `timeout'.  If a bell is already ringing,
        turn it off for an instant before setting the new one.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnumach/gnumach/oskit/pc/osenv_bell.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gnumach/oskit/pc/osenv_bell.c
diff -u gnumach/oskit/pc/osenv_bell.c:1.2 gnumach/oskit/pc/osenv_bell.c:1.3
--- gnumach/oskit/pc/osenv_bell.c:1.2   Mon May 27 19:01:57 2002
+++ gnumach/oskit/pc/osenv_bell.c       Tue Nov  5 19:52:36 2002
@@ -6,12 +6,22 @@
 
 #include "time_out.h"
 
-
 #define BELL_FREQUENCY 750     /* Hz */
+#define        BELL_DURATION   (hz>>3) /* 1/8th second duration */
+
+/* This is the private timer used to turn off the speaker.  */
+static timer_elt_data_t bell_timer = { fcn: (int (*)()) &pc_speaker_off };
 
 void
-direct_cons_bell(void)
+direct_cons_bell (void)
 {
+  /* Cancel the timeout for a bell we are already ringing.  */
+  if (reset_timeout (&bell_timer))
+    /* Turn the speaker off for an instant to distinguish this bell
+       from the next.  */
+    pc_speaker_off ();
+
+  /* Turn the speaker on and set the timeout to turn it off.  */
   pc_speaker_on (BELL_FREQUENCY);
-  timeout (&pc_speaker_off, 0, hz / 8);        /* 1/8th second duration */
+  set_timeout (&bell_timer, BELL_DURATION);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]