[wesnoth-commits] [wesnoth/wesnoth] 519447: Convert uses of boost::thread to std::thread
GitHub
noreply at github.com
Wed Oct 17 01:31:21 UTC 2018
Branch: refs/heads/master
Home: https://github.com/wesnoth/wesnoth
Commit: 519447b0cb049e5e9ec7dfb8a06a3af7c6c60f44
https://github.com/wesnoth/wesnoth/commit/519447b0cb049e5e9ec7dfb8a06a3af7c6c60f44
Author: Charles Dang <exodia339 at gmail.com>
Date: 2018-10-17 (Wed, 17 Oct 2018)
Changed paths:
M src/events.cpp
M src/gui/dialogs/loading_screen.cpp
M src/gui/dialogs/loading_screen.hpp
M src/wesnothd_connection.cpp
M src/wesnothd_connection.hpp
Log Message:
-----------
Convert uses of boost::thread to std::thread
Also covers uses of boost::this_thread.
Turns out std::thread calls std::terminate if it's destroyed while still joinable.
thread::detach needs to be called or else the program will crash.
There's also no standard library equivalent of boost::thread::timed_join so I just
replaced it with the is_worker_running_ variable.
Commit: f5125ea86081d965bf0d4a84b588c94e58a8b6a2
https://github.com/wesnoth/wesnoth/commit/f5125ea86081d965bf0d4a84b588c94e58a8b6a2
Author: Charles Dang <exodia339 at gmail.com>
Date: 2018-10-17 (Wed, 17 Oct 2018)
Changed paths:
M src/gui/dialogs/loading_screen.cpp
M src/gui/dialogs/loading_screen.hpp
Log Message:
-----------
Loading Screen: refactor and clean up implementation
This covers several things:
Instead of creating a new worker thread manually and having it set class member state flags,
I instead utilized std::future and std::async. As far as I can tell, this should avoid the
(albeit unlikely) potential race condition wherein the ls could close before loading at all
if the thread was delayed in starting.
Removed the timer interface and split it into two components:
* A drawing callback that handles the animation. This has its granularity retained at 100 ms,
but can be easily adjusted if we want it to go faster.
* A pump monitor that runs much more frequently (every time events::run_event_loop is called,
technically). This handles checking the state of the std::future object and will then close
the window. This makes the loading screen a bit speedier compared to the previous iteration
since it no longer wastes time waiting for the next timer callback to close.
The one bit I'm not 100% sure about is the check for the future object's ready state in the dtor.
Though, relatedly, I wonder if perhaps we should wait for the worker thread to complete in that
case instead of exiting....
Also shuffled a few things around, such as immediately setting enter/esc disabled in pre_show
instead of waiting for everything there to finish.
Do note there occasionally seem to be a few odd issues with the dot animation after this commit.
Will look into that. But it may be some texture cache-related issue...
This also cleans up some unused log defines and a VS 2013 conditional include.
Commit: dbbd153d3f6f835fe9c7f8543358b3ac6b475f2e
https://github.com/wesnoth/wesnoth/commit/dbbd153d3f6f835fe9c7f8543358b3ac6b475f2e
Author: Charles Dang <exodia339 at gmail.com>
Date: 2018-10-17 (Wed, 17 Oct 2018)
Changed paths:
M src/gui/dialogs/loading_screen.cpp
Log Message:
-----------
Loading Screen: temporarily disable animation rate limiter
Seems to make the loading screen progress faster and gets rid of the weird issue
where the animation sometime wouldn't show up on game launch. Odd.
Commit: 121365f4d29745d58e5671559e50d7cda2630103
https://github.com/wesnoth/wesnoth/commit/121365f4d29745d58e5671559e50d7cda2630103
Author: Charles Dang <exodia339 at gmail.com>
Date: 2018-10-17 (Wed, 17 Oct 2018)
Changed paths:
M src/gui/dialogs/loading_screen.cpp
Log Message:
-----------
Loading Screen: rethrow exception if worker thread creation fails
Compare: https://github.com/wesnoth/wesnoth/compare/ae5c5c40433a...121365f4d297
**NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/
Functionality will be removed from GitHub.com on January 31st, 2019.
More information about the Commits
mailing list