Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should SDL_CreateThread() work? #95

Open
javierdlr opened this issue Apr 17, 2024 · 3 comments
Open

should SDL_CreateThread() work? #95

javierdlr opened this issue Apr 17, 2024 · 3 comments

Comments

@javierdlr
Copy link

Hi, I just updated ZGloom (https://github.com/javierdlr/ZGloom_amigaos4 forked from https://github.com/Swizpig/ZGloom) and whne I enable "multithread rendering" option system crashes (attached).
Crashlog_ZGloom.zip
Crashlog_SDL thread floorthread.zip

it uses SDL_CreateThread() and SDL_LockMutex() in renderer.cpp

I build using "-athread=native -lpthread"
ppc-amigaos-g++ zgui.o binresource.o config.o decrunchmania.o font.o gamelogic.o gloommap.o gloommaths.o hud.o iffhandler.o menuscreen.o monsterlogic.o objectgraphics.o quick.o renderer.o script.o soundhandler.o titlescreen.o zgloom.o -I./LIBS/include -L./LIBS/lib -L/work/local/newlib/lib -fstack-protector -lSDL2_mixer -lxmp-lite -lmodplug -lSDL2_image -ltiff -lwebp -lpng16 -ljpeg -lSDL2 -lz -athread=native -lpthread -o ZGloom.debug

@capehill
Copy link

First crashlog has nothing todo with SDL as far as I can see, some C++ issue?

SDL thread is used to play audio, for example, so it is expected to work. There are also thread test programs in test/ directory.

However, in this case, on AmigaOS 4, I don't any sense to enable this multithread rendering for the following reasons:

  1. Single-core operating system
  2. This game engine is creating 2 threads (== AmigaOS processes) during each frame! This is horrible. Those threads should be pooled.
  3. Thread creation result is not checked. If it fails, crash.

Please don't enable multirendering.

If you are more curious about the problem, use debug variants of SDL2 libraries and look at the serial.

PS. Not sure why -lpthread is used, at least SDL2 doesn't use it.

@javierdlr
Copy link
Author

javierdlr commented Apr 22, 2024 via email

@javierdlr
Copy link
Author

javierdlr commented Apr 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants