The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Thread management in SDL
Owen Alanzo Hogarth
Guest

From this URL: https://wiki.libsdl.org/CategoryThread

there's this quote right at the top of the page:

NOTE: You should not expect to be able to create a window, render, or receive events on any thread other than the main one. For platform-specific exceptions or complicated options ask on the mailing listor forum.This is the issue that I am running into on android for implementing multiple instances.


I will need to be able to create multiple main threads but I do not need to interact with more than one thread at a time.


How is the SDL main thread created on android and when does that get attached to the SDL lifecycle?


Would it be possible to create the thread, pause it and then give that thread a egl surface at a later time?
Thread management in SDL
hardcoredaniel
Guest

If I read this correctly

http://developer.android.com/guide/components/processes-and-threads.html#Threads

then the system creates the "main" thread by itself upon launch of the app. And this is probably the only one that is allowed to do UI work, as also noted in the SDL wiki.

My best guess is that this limitation is intended. Only one thread per app/process/... shall render to screen.


---------- Původní zpráva ----------
Od: Owen Alanzo Hogarth
Komu: SDL Development List
Datum: 28. 9. 2015 13:54:06
Předmět: [SDL] Thread management in SDL
Quote:
From this URL: https://wiki.libsdl.org/CategoryThread

there's this quote right at the top of the page:

NOTE: You should not expect to be able to create a window, render, or receive events on any thread other than the main one. For platform-specific exceptions or complicated options ask on the mailing listor forum.This is the issue that I am running into on android for implementing multiple instances.


I will need to be able to create multiple main threads but I do not need to interact with more than one thread at a time.


How is the SDL main thread created on android and when does that get attached to the SDL lifecycle?


Would it be possible to create the thread, pause it and then give that thread a egl surface at a later time?




_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Thread management in SDL
Owen Alanzo Hogarth
Guest

I can manage the main thread from android, the main issue happens is if I try to init sdl twice, i'll get a crash, because android only gives you one surface at a time.

What I would like to do is be able to init SDL and not have it crash, then be able to pass it a surface for it to associate with and setup. I'll never actually be rendering on two surfaces at once but I need up to two instances of SDL running keeping their state separate. One with an active window and one with a window.


Is there a way to say SDL then at a later time tell SDL to create a window by passing it a surface?


On Mon, Sep 28, 2015 at 8:06 PM, hardcoredaniel wrote:
Quote:
If I read this correctly

http://developer.android.com/guide/components/processes-and-threads.html#Threads

then the system creates the "main" thread by itself upon launch of the app. And this is probably the only one that is allowed to do UI work, as also noted in the SDL wiki.

My best guess is that this limitation is intended. Only one thread per app/process/... shall render to screen.


---------- Původní zpráva ----------
Od: Owen Alanzo Hogarth
Komu: SDL Development List
Datum: 28. 9. 2015 13:54:06
Předmět: [SDL] Thread management in SDL
Quote:
From this URL: https://wiki.libsdl.org/CategoryThread

there's this quote right at the top of the page:

NOTE: You should not expect to be able to create a window, render, or receive events on any thread other than the main one. For platform-specific exceptions or complicated options ask on the mailing listor forum.This is the issue that I am running into on android for implementing multiple instances.


I will need to be able to create multiple main threads but I do not need to interact with more than one thread at a time.


How is the SDL main thread created on android and when does that get attached to the SDL lifecycle?


Would it be possible to create the thread, pause it and then give that thread a egl surface at a later time?






_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org