]> code.delx.au - pulseaudio/blobdiff - src/daemon/cpulimit.c
Remove pa_bool_t and replace it with bool.
[pulseaudio] / src / daemon / cpulimit.c
index f5042a754ded24ac4237d8196354bf3e96bde0e4..7c753978d494c975aa3e1ba2c843b20bd59e765f 100644 (file)
 #include <config.h>
 #endif
 
-#include <pulse/error.h>
 #include <pulse/rtclock.h>
 #include <pulse/timeval.h>
 
-#include <pulsecore/core-rtclock.h>
 #include <pulsecore/core-util.h>
 #include <pulsecore/core-error.h>
 #include <pulsecore/log.h>
@@ -40,7 +38,6 @@
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
-#include <sys/time.h>
 #include <unistd.h>
 #include <signal.h>
 
@@ -83,10 +80,10 @@ static pa_io_event *io_event = NULL;
 static struct sigaction sigaction_prev;
 
 /* Nonzero after pa_cpu_limit_init() */
-static pa_bool_t installed = FALSE;
+static bool installed = false;
 
 /* The current state of operation */
-static enum  {
+static enum {
     PHASE_IDLE,   /* Normal state */
     PHASE_SOFT    /* After CPU overload has been detected */
 } phase = PHASE_IDLE;
@@ -140,7 +137,7 @@ static void signal_handler(int sig) {
             write_err("Soft CPU time limit exhausted, terminating.\n");
 
             /* Try a soft cleanup */
-            (void) write(the_pipe[1], &c, sizeof(c));
+            (void) pa_write(the_pipe[1], &c, sizeof(c), NULL);
             phase = PHASE_SOFT;
             reset_cpu_time(CPUTIME_INTERVAL_HARD);
 
@@ -170,7 +167,7 @@ static void callback(pa_mainloop_api*m, pa_io_event*e, int fd, pa_io_event_flags
 
     pa_log("Received request to terminate due to CPU overload.");
 
-    pa_read(the_pipe[0], &c, sizeof(c), NULL);
+    (void) pa_read(the_pipe[0], &c, sizeof(c), NULL);
     m->quit(m, 1); /* Quit the main loop */
 }
 
@@ -212,7 +209,7 @@ int pa_cpu_limit_init(pa_mainloop_api *m) {
         return -1;
     }
 
-    installed = TRUE;
+    installed = true;
 
     reset_cpu_time(CPUTIME_INTERVAL_SOFT);
 
@@ -233,7 +230,7 @@ void pa_cpu_limit_done(void) {
 
     if (installed) {
         pa_assert_se(sigaction(SIGXCPU, &sigaction_prev, NULL) >= 0);
-        installed = FALSE;
+        installed = false;
     }
 }