ObjFW  Check-in [903b3326e2]

Overview
Comment:Fix releasing semaphore stored in free'd memory
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 903b3326e2d32f54693d9f244c43a89d56d07a418f574ce30f95176a936d85d4
User & Date: js on 2020-06-14 15:32:53
Other Links: manifest | tags
Context
2020-06-14
15:50
Add a function wrapper for threads on Windows check-in: e342aa8358 user: js tags: trunk
15:32
Fix releasing semaphore stored in free'd memory check-in: 903b3326e2 user: js tags: trunk
15:30
Make threads work on Windows 98 check-in: e16590dcb7 user: js tags: trunk
Changes

Modified src/platform/amiga/thread.m from [7b264a994b] to [de7e15e20a].

164
165
166
167
168
169
170
171
172


173
174
175
176

177
178
179
180
181
182
183
	return of_tlskey_get(threadKey);
}

bool
of_thread_join(of_thread_t thread)
{
	ObtainSemaphore(&thread->semaphore);
	@try {
		if (thread->done) {


			free(thread);
			return true;
		}


		if (thread->detached || thread->joinTask != NULL) {
			errno = EINVAL;
			return false;
		}

		if ((thread->joinSigBit = AllocSignal(-1)) == -1) {
			errno = EAGAIN;







|
|
>
>
|
|
|

>







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
	return of_tlskey_get(threadKey);
}

bool
of_thread_join(of_thread_t thread)
{
	ObtainSemaphore(&thread->semaphore);

	if (thread->done) {
		ReleaseSemaphore(&thread->semaphore);

		free(thread);
		return true;
	}

	@try {
		if (thread->detached || thread->joinTask != NULL) {
			errno = EINVAL;
			return false;
		}

		if ((thread->joinSigBit = AllocSignal(-1)) == -1) {
			errno = EAGAIN;