Skip to content

Commit dbfd4ce

Browse files
committed
examples: use exit() instead of pthread_exit() from main thread.
OSX seems to spawn an extra thread for GLUT. As a result, we can't just call pthread_exit() because there's still one thread left after we kill all the threads we directly spawned, so the examples never stop running. Signed-off-by: Drew Fisher <[email protected]>
1 parent 0b72b1b commit dbfd4ce

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

examples/glview.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ void keyPressed(unsigned char key, int x, int y)
153153
free(rgb_back);
154154
free(rgb_mid);
155155
free(rgb_front);
156-
pthread_exit(NULL);
156+
// Not pthread_exit because OSX leaves a thread lying around and doesn't exit
157+
exit(0);
157158
}
158159
if (key == 'w') {
159160
freenect_angle++;

examples/hiview.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ void keyPressed(unsigned char key, int x, int y)
178178
free(rgb_back);
179179
free(rgb_mid);
180180
free(rgb_front);
181-
pthread_exit(NULL);
181+
// Not pthread_exit because OSX leaves a thread lying around and doesn't exit
182+
exit(0);
182183
}
183184
if (key == 'f') {
184185
// Cycle through:

0 commit comments

Comments
 (0)