Skip to content

Commit

Permalink
examples: use exit() instead of pthread_exit() from main thread.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
zarvox committed Jul 24, 2011
1 parent 0b72b1b commit dbfd4ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/glview.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ void keyPressed(unsigned char key, int x, int y)
free(rgb_back);
free(rgb_mid);
free(rgb_front);
pthread_exit(NULL);
// Not pthread_exit because OSX leaves a thread lying around and doesn't exit
exit(0);
}
if (key == 'w') {
freenect_angle++;
Expand Down
3 changes: 2 additions & 1 deletion examples/hiview.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ void keyPressed(unsigned char key, int x, int y)
free(rgb_back);
free(rgb_mid);
free(rgb_front);
pthread_exit(NULL);
// Not pthread_exit because OSX leaves a thread lying around and doesn't exit
exit(0);
}
if (key == 'f') {
// Cycle through:
Expand Down

0 comments on commit dbfd4ce

Please sign in to comment.