ObjFW  Check-in [a65818a67f]

Overview
Comment:configure: Check for pthread_attr_setinheritsched
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a65818a67fc5b91428d0702caa414bc42b2d7ce50a59c521060fdb3266d350a4
User & Date: js on 2016-01-05 17:15:46
Other Links: manifest | tags
Context
2016-01-05
17:49
tests/Makefile: Copy shared libs in run-on-android check-in: a200d99be5 user: js tags: trunk
17:15
configure: Check for pthread_attr_setinheritsched check-in: a65818a67f user: js tags: trunk
17:11
undef __{unsafe_unretained,bridge,autoreleasing} check-in: 3d11f9ee8f user: js tags: trunk
Changes

Modified configure.ac from [dfcebab81d] to [7398d6725d].

605
606
607
608
609
610
611


612
613
614
615
616
617
618
				[Whether we have pthread spinlocks])
		])

		AC_CHECK_FUNC(sched_yield, [
			AC_DEFINE(OF_HAVE_SCHED_YIELD, 1,
				[Whether we have sched_yield()])
		])



		AC_CHECK_HEADERS(pthread_np.h, [], [], [#include <pthread.h>])
		AC_CHECK_FUNCS(pthread_set_name_np pthread_setname_np, break)
		;;
	esac

	AC_DEFINE(OF_HAVE_THREADS, 1, [Whether we have threads])







>
>







605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
				[Whether we have pthread spinlocks])
		])

		AC_CHECK_FUNC(sched_yield, [
			AC_DEFINE(OF_HAVE_SCHED_YIELD, 1,
				[Whether we have sched_yield()])
		])

		AC_CHECK_FUNCS(pthread_attr_setinheritsched)

		AC_CHECK_HEADERS(pthread_np.h, [], [], [#include <pthread.h>])
		AC_CHECK_FUNCS(pthread_set_name_np pthread_setname_np, break)
		;;
	esac

	AC_DEFINE(OF_HAVE_THREADS, 1, [Whether we have threads])

Modified src/threading_pthread.m from [bf9bfb4388] to [3649baa422].

102
103
104
105
106
107
108

109
110
111

112
113
114
115
116
117
118

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

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


			if (pthread_attr_setinheritsched(&pattr,
			    PTHREAD_EXPLICIT_SCHED) != 0)
				return false;


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

			if (attr->stackSize > 0) {
				if (pthread_attr_setstacksize(&pattr,
				    attr->stackSize) != 0)







>



>







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

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

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

#ifdef HAVE_PTHREAD_ATTR_SETINHERITSCHED
			if (pthread_attr_setinheritsched(&pattr,
			    PTHREAD_EXPLICIT_SCHED) != 0)
				return false;
#endif

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

			if (attr->stackSize > 0) {
				if (pthread_attr_setstacksize(&pattr,
				    attr->stackSize) != 0)