main_thread

Discussion of all aspects of the game engine, including development of new and existing features.

Moderators: Forum Moderators, Developers

main_thread

Postby alep » December 19th, 2016, 2:54 pm

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:

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();


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 ;) ).
alep
Android Port Maintainer
 
Posts: 135
Joined: June 24th, 2013, 6:22 am

Re: main_thread

Postby Celtic_Minstrel » May 3rd, 2017, 3:55 am

I suggest opening a pull request to the main Wesnoth repository which instead initializes the variable from main(), like you described.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.
User avatar
Celtic_Minstrel
Developer
 
Posts: 753
Joined: August 3rd, 2012, 11:26 pm


Return to Coder’s Corner

Who is online

Users browsing this forum: No registered users and 3 guests