main_thread
Moderator: Forum Moderators
main_thread
Hello.
I was starting to try out the 1.13 version for android, and the first run gave me a black screen. After digging out a bit I stumled upon this lines in events.cpp:
That was the cause of the black screen: since I load c++ code from a shared object (.so) on a different thread from the one that's going to run wesnoth, this gets initialized to a wrong value.
I fixed that in android version by adding an #ifdef ANDROID and let main() initialize the variable, but because of the comment I also wanted to let you know that no, it's not safe to initialize main_thread like that (at least, in my android port it is not ).
I was starting to try out the 1.13 version for android, and the first run gave me a black screen. After digging out a bit I stumled upon this lines in events.cpp:
Code: Select all
// TODO: I'm uncertain if this is always safe to call at static init; maybe set in main() instead?
static const boost::thread::id main_thread = boost::this_thread::get_id();
I fixed that in android version by adding an #ifdef ANDROID and let main() initialize the variable, but because of the comment I also wanted to let you know that no, it's not safe to initialize main_thread like that (at least, in my android port it is not ).
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: main_thread
I suggest opening a pull request to the main Wesnoth repository which instead initializes the variable from main(), like you described.