[wesnoth-commits] [wesnoth/wesnoth] acc3fe: Refactor out custom wesnothd_connection_ptr class ...

GitHub noreply at github.com
Thu Apr 12 23:24:55 UTC 2018


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: acc3fe890611b54c8493acafc33f1e78832b65dc
      https://github.com/wesnoth/wesnoth/commit/acc3fe890611b54c8493acafc33f1e78832b65dc
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2018-04-13 (Fri, 13 Apr 2018)

  Changed paths:
    M src/game_initialization/multiplayer.cpp
    M src/wesnothd_connection.cpp
    M src/wesnothd_connection.hpp

  Log Message:
  -----------
  Refactor out custom wesnothd_connection_ptr class again

I originally did this in 699047766a8852014df20c44d5ed84dadb37015e and then reverted it in
08a866dc20e678602f65f0cdedb21fb28a0bfa8c due to @gfgtdf pointing out the object was never
actually destroyed since io_service::stop was never called (issue #1927).

This new method foregoes the custom wrapper class and instead waits for the worker thread
to terminate in the wesnothd_connection dtor. The use of the wrapper class is also why using
thread::detach alone worked (@jyrkive) and using join did not.

Additionally, the ptr alias is now of a unique_ptr instead of a shared_ptr.

I have verified that the connection dtor is actually called. This new method makes it clearer
what's actually going on.




More information about the Commits mailing list