Exit main thread with winpr_exit to trigger resource cleanup.

When using pthread_once with destructors they are only called,
if each thread (including the main thread) is exited with pthread_exit.
Introducing winpr_exit as a wrapper for that purpose.
This commit is contained in:
Armin Novak
2018-02-09 12:25:45 +01:00
parent 7e26c54866
commit 2d58e96dcc
17 changed files with 67 additions and 49 deletions

View File

@@ -60,7 +60,7 @@ int main(int argc, char** argv)
if (!display)
{
WLog_ERR(TAG, "Cannot open display");
exit(1);
return winpr_exit(1);
}
x = 10;
@@ -96,12 +96,12 @@ int main(int argc, char** argv)
engine = rdtk_engine_new();
if (!engine)
return 1;
return winpr_exit(1);
scanline = width * 4;
buffer = (BYTE*) calloc(height, scanline);
if (!buffer)
return 1;
return winpr_exit(1);
surface = rdtk_surface_new(engine, buffer, width, height, scanline);
@@ -150,5 +150,5 @@ int main(int argc, char** argv)
rdtk_engine_free(engine);
return 0;
return winpr_exit(0);
}