On 2015/06/17 13:34, Christian Halaszovich <[email protected]> wrote:
> Patch 1/2. Check the return value of sched_setscheduler() in
> SetThreadRealtime. Report to the caller, if we were successful. To this end
> SetThreadRealtime now returns false, if ached_setschedluer failed or true
> on all other cases. On non-linux systems SetThreadRealtime does not do
> anything and will always return true.

If you return failure, it should also describe why, for example by
filling out an Error object.

> + * return value: true on success

Misformatted.  Should use doxygen syntax.

> + bool success = true;

Why this variable?

>  #ifdef __linux__
>   struct sched_param sched_param;
>   sched_param.sched_priority = 50;
> @@ -94,8 +96,9 @@ SetThreadRealtime()
>   policy |= SCHED_RESET_ON_FORK;
>  #endif
> 
> - sched_setscheduler(0, policy, &sched_param);
> + success = 0==sched_setscheduler(0, policy, &sched_param);

 return sched_setscheduler(...) == 0;

>  #endif
> + return success; // on non-linux machines we will always pretend it worked

 #else
 return true;
 #endif
_______________________________________________
mpd-devel mailing list
[email protected]
http://mailman.blarg.de/listinfo/mpd-devel

Reply via email to