]> rtime.felk.cvut.cz Git - frescor/fosa.git/blobdiff - src_aquosa/fosa_time.c
Allow for mutexes and condvars to be shared among different processes.
[frescor/fosa.git] / src_aquosa / fosa_time.c
index 571ccce8ce787512ab4d7a4aecbb11f21b8e08a0..a259a375c8b1dfcd11f494ee8581994d6cf468c0 100644 (file)
  **/
 void inline fosa_eat(const struct timespec *cpu_time)
 {
-       int error;
+       int ret;
        fosa_thread_id_t self;
        clockid_t clock_id;
        struct timespec current_time, time_to_go;
 
        self = fosa_thread_self();
-       error = fosa_thread_get_cputime_clock(self, &clock_id);
-       if (!error)
-               return;
+       ret = fosa_thread_get_cputime_clock(self, &clock_id);
+       if (ret) return;
 
-       if (clock_gettime(clock_id, &current_time) != 0)
-                       return;
+       ret = clock_gettime(clock_id, &current_time);
+       if (ret) return;
 
        time_to_go = fosa_abs_time_incr(current_time, *cpu_time);
-       while (fosa_abs_time_smaller_or_equal(current_time, time_to_go))
-               if (clock_gettime(clock_id, &current_time) != 0)
-                       return;
+       while (fosa_abs_time_smaller_or_equal(current_time, time_to_go)) {
+               ret = clock_gettime(clock_id, &current_time);
+               if (ret) return;
+       }
 }