ObjFW  Check-in [60ebb21fc7]

Overview
Comment:threading_pthread.m: Only set stack size if > 0

When initializing a pthread_attr_t on Solaris and reading the stack size
from it with pthread_attr_getstacksize(), the stack size returned it 0.
However, when calling pthread_attr_setstacksize() with a stack size of
0, the call fails.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 60ebb21fc797c2cee681ee194c82d000198b65814def44cb8f7fe1ad70946ebf
User & Date: js on 2015-04-11 14:37:34
Other Links: manifest | tags
Context
2015-04-11
16:17
OFStringTests: Work around Solaris/x86's rounding check-in: 8a087107aa user: js tags: trunk
14:37
threading_pthread.m: Only set stack size if > 0 check-in: 60ebb21fc7 user: js tags: trunk
14:17
forwarding-x86-elf.S: Use @GOTOFF / @GOT check-in: 20314bea6c user: js tags: trunk
Changes

Modified src/threading_pthread.m from [7f18dc085f] to [5e32541977].

105
106
107
108
109
110
111

112
113
114

115
116
117
118
119
120
121
			if (pthread_attr_setinheritsched(&pattr,
			    PTHREAD_EXPLICIT_SCHED) != 0)
				return false;

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


			if (pthread_attr_setstacksize(&pattr,
			    attr->stackSize) != 0)
				return false;

		}

		if ((ctx = malloc(sizeof(*ctx))) == NULL)
			return false;

		ctx->function = function;
		ctx->object = object;







>
|
|
|
>







105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
			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)
					return false;
			}
		}

		if ((ctx = malloc(sizeof(*ctx))) == NULL)
			return false;

		ctx->function = function;
		ctx->object = object;