Skip to content

Multithreading 7/N: Add support to calling SDL 1.x from pthreads#5532

Merged
juj merged 1 commit intoemscripten-core:incomingfrom
juj:sdl_in_pthreads
Nov 10, 2017
Merged

Multithreading 7/N: Add support to calling SDL 1.x from pthreads#5532
juj merged 1 commit intoemscripten-core:incomingfrom
juj:sdl_in_pthreads

Conversation

@juj
Copy link
Collaborator

@juj juj commented Aug 26, 2017

Adds support for calling SDL API from pthreads by synchronously proxying to main thread. This makes pthreads "see" the JavaScript state of SDL held in the main browser thread, so that multiple threads all act like they have one coherent state of SDL data structures. That allows one thread to call SDL_Init, and it will be in effect for all other threads as well.

@juj
Copy link
Collaborator Author

juj commented Aug 26, 2017

This depends on #5531 to land first.

@kripken
Copy link
Member

kripken commented Sep 6, 2017

How about using a loop at the end of the file to add all these annotations, instead of manually? We do that for other repetitive things.

@juj
Copy link
Collaborator Author

juj commented Sep 7, 2017

Setting in a loop would remove the foo__proxy: [...] part, but not the foo__sig part, and the information would need to be stored somehow still, via a sync_sdl_funcs = ['func1', 'func2' ...']; async_sdl_funcs = ['func3', 'func4'];. Then to understand the proxying model one would need to be jumping between two places in code, and to double check that each function indeed has an attribute specified and none of them missed it (not having an attribute is not an error, but calls in the current thread). I would prefer having these annotations where each function is, that seems like the cleanest way to read the code, even if a bit verbose?

@kripken
Copy link
Member

kripken commented Sep 12, 2017

Fair enough, lgtm.

@juj juj merged commit 9920de2 into emscripten-core:incoming Nov 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants