Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OGRE-206] Hide threading header #47

Closed
paroj opened this issue Nov 29, 2015 · 9 comments
Closed

[OGRE-206] Hide threading header #47

paroj opened this issue Nov 29, 2015 · 9 comments

Comments

@paroj
Copy link
Member

paroj commented Nov 29, 2015

[reporter="Ogre.Transporter", created="Fri, 14 Jun 2013 22:12:38 +0200"]

It would be nice to hide the headers of threading dependencies. Have a look what happend after including Ogre.h:

Ogre.h -> OgrePrerequisites.h -> OgrePlatform.h -> OgreConfig.h -> OgreBuildSettings.h
Code: Select all#define OGRE_THREAD_SUPPORT 2

#define OGRE_THREAD_PROVIDER 1

Ogre.h -> OgrePrerequisites.h -> Threading/OgreThreadDefines.h -> Threading/OgreThreadDefinesBoost.h
Ogre.h -> OgrePrerequisites.h -> OgreStdHeaders.h -> Threading/OgreThreadHeaders.h -> Threading/OgreThreadHeadersBoost.h -> BOOST

That means you have to add boost to all Ogre projects. Even if you use Ogre as shared libraries, you also have to add boost. It would be helpful to include the threading libraries only in cpp code or headers which only used for building Ogre to avoid including any external library using the SDK. Using windows is also adding more issues because of boost auto linking, which is enabled by default.

Thread: http://www.ogre3d.org/forums/viewtopic.php?f=3&t=78190

Edit: It looks like that TBB has the same problem (https://bitbucket.org/transporter/ogre-procedural/issues/147/boost-and-tbb-headers-and-libraries-not)

@paroj
Copy link
Member Author

paroj commented Nov 29, 2015

[author="masterfalcon", created="Fri, 14 Jun 2013 22:47:33 +0200"]

Does this resolve the issue for you?

@paroj
Copy link
Member Author

paroj commented Nov 29, 2015

[author="ogre.transporter", created="Sat, 15 Jun 2013 10:50:00 +0200"]

No:

OgrePaging:
OgreAtomicWrappers.h(119): error C2143: Syntaxfehler: Es fehlt ';' vor 'volatile'

RenderSystem_Direct3D9:
OgreD3D9Resource.h(73): error C2061: Syntaxfehler: Bezeichner 'msDeviceAccessMutex'
OgreD3D9Resource.h(74): error C2143: Syntaxfehler: Es fehlt ';' vor '}'
OgreD3D9Resource.h(74): error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt.
OgreD3D9ResourceManager.h(116): error C2061: Syntaxfehler: Bezeichner 'mResourcesMutex'
OgreD3D9ResourceManager.h(117): error C3646: "ResourceContainer": Unbekannter Überschreibungsspezifizierer
OgreD3D9ResourceManager.h(117): error C3646: "mResources": Unbekannter Überschreibungsspezifizierer
OgreD3D9ResourceManager.h(117): error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt.
OgreD3D9ResourceManager.cpp(64): error C2065: 'mResourcesMutex': nichtdeklarierter Bezeichner
OgreD3D9ResourceManager.cpp(66): error C2065: 'mResources': nichtdeklarierter Bezeichner
OgreD3D9ResourceManager.cpp(66): error C2228: Links von ".begin" muss sich eine Klasse/Struktur/Union befinden.
Typ ist ''unknown-type''
OgreD3D9ResourceManager.cpp(67): error C2065: 'mResources': nichtdeklarierter Bezeichner
OgreD3D9ResourceManager.cpp(67): error C2228: Links von ".end" muss sich eine Klasse/Struktur/Union befinden.
Typ ist ''unknown-type''
OgreD3D9ResourceManager.cpp(67): fatal error C1903: Weiterverarbeitung nach vorherigem Fehler nicht möglich; Kompilierung wird abgebrochen.
OgreD3D9Resource.cpp(34): error C2039: 'msDeviceAccessMutex': Ist kein Element von 'Ogre::D3D9Resource'
E:\ogre-test\RenderSystems\Direct3D9\include\OgreD3D9Resource.h(40): Siehe Deklaration von 'Ogre::D3D9Resource'

@paroj
Copy link
Member Author

paroj commented Nov 29, 2015

[author="masterfalcon", created="Sat, 15 Jun 2013 18:47:04 +0200"]

With the exception of build errors, does it resolve the core issue of header inclusion?

@paroj
Copy link
Member Author

paroj commented Nov 29, 2015

[author="ogre.transporter", created="Sat, 15 Jun 2013 22:57:39 +0200"]

No. Thanks for your effort! I've rebuilt Ogre without paging and DX9 succesfully. But there are more threading includes like

Ogre.h -> OgreArchive.h -> OgreSharedPtr.h -> Threading/OgreThreadHeaders.h -> Threading/OgreThreadHeadersBoost.h -> BOOST

@paroj
Copy link
Member Author

paroj commented Nov 29, 2015

[author="masterfalcon", created="Sun, 16 Jun 2013 03:41:29 +0200"]

See, the problem there is that OgreSharedPtr.h and also OgreLog.h both use mutexes in their headers and need the thread defines, which in turn need the types that they are defining. I don't see any way around it at the moment. Do you have any ideas?

@paroj
Copy link
Member Author

paroj commented Nov 29, 2015

[author="ogre.transporter", created="Sun, 16 Jun 2013 12:48:05 +0200"]

You're right, this is a large problem. I think the only way is creating a mutex object which is wrapping the real mutex in code without loading boost through ist header file. Maybe we can collect additional suggestions in the forum.

@paroj
Copy link
Member Author

paroj commented Nov 29, 2015

[author="masterfalcon", created="Sun, 23 Jun 2013 07:32:28 +0200"]

Thanks to the work with OGRE-211, I was able to make some changes to make this a little better. Not perfect but hopefully an improvement.

@paroj
Copy link
Member Author

paroj commented Nov 29, 2015

[author="ogre.transporter", created="Fri, 24 Jul 2015 08:46:41 +0200"]

A complete threading wrapper is required to hide boost/tbb headers from ogre include files.

@paroj paroj removed boost labels Apr 13, 2017
@paroj paroj added this to the 1.11 milestone Jul 2, 2017
@paroj paroj added 📁 OgreMain and removed core labels Nov 18, 2017
@paroj
Copy link
Member Author

paroj commented Apr 8, 2018

the preferred threading path is now std::thread - while not really solving the issue at hand, it makes it much less critical

@paroj paroj closed this as completed Apr 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant