[pisa-src] r1315 - trunk/libpisa/scheduler.c

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Tue, 27 Oct 2009 14:30:26 +0100

Author: tjansen
Date: Tue Oct 27 14:30:26 2009
New Revision: 1315

Log:
Fixed warnings:

scheduler.c: In function ‘pisa_sched_main’:
scheduler.c:42: warning: ignoring return value of ‘read’, declared with 
attribute warn_unused_result
scheduler.c:51: warning: ignoring return value of ‘write’, declared with 
attribute warn_unused_result
scheduler.c: In function ‘pisa_sched_run’:
scheduler.c:179: warning: ignoring return value of ‘write’, declared with 
attribute warn_unused_result
scheduler.c: In function ‘pisa_sched_add’:
scheduler.c:213: warning: ignoring return value of ‘write’, declared with 
attribute warn_unused_result
scheduler.c: In function ‘pisa_sched_remove’:
scheduler.c:233: warning: ignoring return value of ‘write’, declared with 
attribute warn_unused_result

Modified:
   trunk/libpisa/scheduler.c

Modified: trunk/libpisa/scheduler.c
==============================================================================
--- trunk/libpisa/scheduler.c   Tue Oct 27 14:22:36 2009        (r1314)
+++ trunk/libpisa/scheduler.c   Tue Oct 27 14:30:26 2009        (r1315)
@@ -39,7 +39,8 @@
                if (FD_ISSET(sched->pipe_sched[0], &fds)) {
                        /* Someone woke us up to reschedule, read the byte */
                        char c;
-                       read(sched->pipe_sched[0], &c, 1);
+                       if (read(sched->pipe_sched[0], &c, 1) != 1)
+                               PISA_ERROR("pisa_sched_main: pipe read 
failed\n");
                }
 
                pthread_mutex_lock(&sched->mutex_list);
@@ -48,7 +49,8 @@
                        /* At least the first action is due now, raise the
                         * flag. As we have to reschedule afterwards, sleep
                         * for a _long_ time. We don't care about tv_usec. */
-                       write(sched->pipe_main[1], "1", 1);
+                       if (write(sched->pipe_main[1], "1", 1) != 1)
+                               PISA_ERROR("pisa_sched_main: pipe write 
failed\n");
                        timeout.tv_sec = 1000000;
                } else {
                        /* No action is due now, sleep until the head is due
@@ -176,7 +178,8 @@
                free(tmp);
        }
 
-       write(sched->pipe_sched[1], "0", 1);
+       if (write(sched->pipe_sched[1], "0", 1) != 1)
+               PISA_ERROR("pisa_sched_run: pipe write failed\n");
 }
 
 /**
@@ -210,7 +213,8 @@
                cur->next = task;
        
        }
-       write(sched->pipe_sched[1], "0", 1);
+       if (write(sched->pipe_sched[1], "0", 1) != 1)
+               PISA_ERROR("pisa_sched_add: pipe write failed\n");
 
        pthread_mutex_unlock(&sched->mutex_list);
 
@@ -230,7 +234,8 @@
        pisa_sched_remove_internal(sched, task);
        free(task);
 
-       write(sched->pipe_sched[1], "0", 1);
+       if (write(sched->pipe_sched[1], "0", 1) != 1)
+               PISA_ERROR("pisa_sched_remove: pipe write failed\n");
 
        pthread_mutex_unlock(&sched->mutex_list);
 }

Other related posts:

  • » [pisa-src] r1315 - trunk/libpisa/scheduler.c - Thomas Jansen