Skip to content

Commit

Permalink
sokol_app.h linux: fix -pthread guard code (use pthread_attr_init/des…
Browse files Browse the repository at this point in the history
…troy)
  • Loading branch information
floooh committed Jan 13, 2021
1 parent 0649a40 commit 5fbb6a2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions sokol_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,7 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
#include <GL/gl.h>
#include <dlfcn.h> /* dlopen, dlsym, dlclose */
#include <limits.h> /* LONG_MAX */
#include <pthread.h> /* only used a linker-guard, search for _sapp_linux_run() and see first comment */
#endif

/*== MACOS DECLARATIONS ======================================================*/
Expand Down Expand Up @@ -10030,12 +10031,14 @@ _SOKOL_PRIVATE void _sapp_x11_process_event(XEvent* event) {
}
}

extern int pthread_yield(void); // see below
_SOKOL_PRIVATE void _sapp_linux_run(const sapp_desc* desc) {
// The following line is here to trigger a linker error instead of an
// obscure runtime error if the user has forgotten to add -pthread to
// the compiler or linker options. It has no other purpose.
pthread_yield();
/* The following lines are here to trigger a linker error instead of an
obscure runtime error if the user has forgotten to add -pthread to
the compiler or linker options. They have no other purpose.
*/
pthread_attr_t pthread_attr;
pthread_attr_init(&pthread_attr);
pthread_attr_destroy(&pthread_attr);

_sapp_init_state(desc);
_sapp.x11.window_state = NormalState;
Expand Down

0 comments on commit 5fbb6a2

Please sign in to comment.