ObjFW  Diff

Differences From Artifact [cdf397d0df]:

To Artifact [7ca1a9fd57]:


31
32
33
34
35
36
37


38
39


40
41
42
43
44
45
46

		minPrio = sched_get_priority_min(policy);
		maxPrio = sched_get_priority_max(policy);

		if (pthread_attr_getschedparam(&pattr, &param) != 0)
			return false;



		attr->priority = (float)(param.sched_priority - minPrio) /
		    (maxPrio - minPrio);



		if (pthread_attr_getstacksize(&pattr, &attr->stackSize) != 0)
			return false;
	} @finally {
		pthread_attr_destroy(&pattr);
	}








>
>
|
|
>
>







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

		minPrio = sched_get_priority_min(policy);
		maxPrio = sched_get_priority_max(policy);

		if (pthread_attr_getschedparam(&pattr, &param) != 0)
			return false;

		/* Prevent possible division by zero */
		if (minPrio != maxPrio)
			attr->priority = (float)(param.sched_priority -
			    minPrio) / (maxPrio - minPrio);
		else
			attr->priority = 0;

		if (pthread_attr_getstacksize(&pattr, &attr->stackSize) != 0)
			return false;
	} @finally {
		pthread_attr_destroy(&pattr);
	}