Page MenuHomeWildfire Games

pthread -> std::thread (1/?) - Clean up ThreadUtil
ClosedPublic

Authored by wraitii on May 25 2019, 7:15 PM.

Details

Reviewers
None
Group Reviewers
Windows Developers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22344: Clean up ThreadUtil, use standard C++11 constructs instead of custom ones.
Summary

ThreadUtil ships a scope lock and a mutex implementation, which can be removed since we now have these in the standard library.
This lets us clean up this header which get included everywhere (through profiler includes).

Test Plan

Compile on all platforms

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

wraitii created this revision.May 25 2019, 7:15 PM
Owners added subscribers: Restricted Owners Package, Restricted Owners Package.May 25 2019, 7:15 PM

Build failure - The Moirai have given mortals hearts that can endure.

Linter detected issues:
Executing section Source...

source/ps/CConsole.h
|   1| /*·Copyright·(C)·2015·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2015"

source/soundmanager/items/CSoundItem.cpp
|   1| /*·Copyright·(C)·2015·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2015"

source/ps/XML/RelaxNG.cpp
|   1| /*·Copyright·(C)·2015·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2015"

source/soundmanager/items/CSoundBase.cpp
|   1| /*·Copyright·(C)·2015·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2015"

source/soundmanager/SoundManager.h
|   1| /*·Copyright·(C)·2017·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2017"

source/soundmanager/SoundManager.cpp
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"

source/ps/Profiler2.h
|   1| /*·Copyright·(C)·2016·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2016"

source/tools/atlas/GameInterface/MessagesSetup.h
|   1| /*·Copyright·(C)·2009·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2009"

source/tools/atlas/GameInterface/MessagesSetup.h
|  31| {
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character '{' when no macros are defined.

source/tools/atlas/GameInterface/MessagesSetup.h
| 211| }
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character '{' when these macros are defined: 'MESSAGESSETUP_NOTFIRST'.

source/tools/atlas/GameInterface/MessagesSetup.h
|  31| {
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character '{' when these macros are defined: '_MSC_VER'.

source/graphics/MapGenerator.cpp
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"

source/ps/UserReport.cpp
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"

source/ps/CLogger.h
|   1| /*·Copyright·(C)·2015·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2015"

source/soundmanager/items/CSoundBase.h
|   1| /*·Copyright·(C)·2015·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2015"

source/ps/CLogger.cpp
|   1| /*·Copyright·(C)·2017·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2017"

source/ps/ConfigDB.cpp
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"

source/ps/Profiler2.cpp
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"

source/ps/Profile.cpp
|   1| /*·Copyright·(C)·2011·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2011"

source/tools/atlas/GameInterface/MessagePasserImpl.cpp
|   1| /*·Copyright·(C)·2013·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2013"

source/tools/atlas/GameInterface/MessagePasserImpl.cpp
| 211| The line belonging to the following result cannot be printed because it refers to a line that doesn't seem to exist in the given file.
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character '{' when these macros are defined: 'MESSAGESSETUP_NOTFIRST'.

source/soundmanager/items/CBufferItem.cpp
|   1| /*·Copyright·(C)·2015·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2015"

source/ps/ThreadUtil.cpp
|   1| /*·Copyright·(C)·2010·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2010"

source/network/NetStats.cpp
|   1| /*·Copyright·(C)·2016·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2016"

source/network/NetStats.h
|   1| /*·Copyright·(C)·2016·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2016"

source/graphics/MapGenerator.h
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"

source/ps/CConsole.cpp
|   1| /*·Copyright·(C)·2016·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2016"

source/tools/atlas/GameInterface/MessagePasserImpl.h
|   1| /*·Copyright·(C)·2009·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2009"
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1489/display/redirect

wraitii updated this revision to Diff 8188.May 28 2019, 4:02 PM

Clean up header and copyright - hopefully compiles without precompiled headers.

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/tools/atlas/GameInterface/MessagesSetup.h
|  31| {
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character '{' when no macros are defined.

source/tools/atlas/GameInterface/MessagesSetup.h
| 211| }
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character '{' when these macros are defined: 'MESSAGESSETUP_NOTFIRST'.

source/tools/atlas/GameInterface/MessagesSetup.h
|  31| {
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character '{' when these macros are defined: '_MSC_VER'.

source/tools/atlas/GameInterface/MessagePasserImpl.cpp
| 211| The line belonging to the following result cannot be printed because it refers to a line that doesn't seem to exist in the given file.
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character '{' when these macros are defined: 'MESSAGESSETUP_NOTFIRST'.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1531/display/redirect

wraitii added a subscriber: Stan.Jun 5 2019, 7:47 PM

@Stan Any chance you'd try compiling this? I'd like to commit it but I want a test on windows first.

Silier added a subscriber: Silier.Jun 5 2019, 8:02 PM

I got these
Profiler2.h(454): error C3646: 'm_TLS': unknown override specifier
Profiler2.h(454): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Silier added inline comments.Jun 5 2019, 8:08 PM
source/ps/ThreadUtil.h
21 ↗(On Diff #8188)

I think they were defined here

Stan added inline comments.Jun 5 2019, 8:28 PM
source/ps/Profiler2.h
80 ↗(On Diff #8188)

Adding "lib/posix/posix_pthread.h" fixes the build for me.

wraitii updated this revision to Diff 8327.Jun 5 2019, 9:13 PM

This should fix it. Can be removed once children patches are committed.

Stan added a comment.Jun 5 2019, 9:26 PM

Indeed that also works.

Vulcan added a comment.Jun 5 2019, 9:34 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/tools/atlas/GameInterface/MessagesSetup.h
|  31| {
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character '{' when no macros are defined.

source/tools/atlas/GameInterface/MessagesSetup.h
| 211| }
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character '{' when these macros are defined: 'MESSAGESSETUP_NOTFIRST'.

source/tools/atlas/GameInterface/MessagesSetup.h
|  31| {
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character '{' when these macros are defined: '_MSC_VER'.

source/tools/atlas/GameInterface/MessagePasserImpl.cpp
| 211| The line belonging to the following result cannot be printed because it refers to a line that doesn't seem to exist in the given file.
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character '{' when these macros are defined: 'MESSAGESSETUP_NOTFIRST'.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1617/display/redirect

builds, tests passed (Release, Debug)

This revision was not accepted when it landed; it landed in state Needs Review.Jun 6 2019, 9:32 PM
This revision was automatically updated to reflect the committed changes.