Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] Hi. I'm new to AzerothCore but with c++ experience.

[DiscordArchive] Hi. I'm new to AzerothCore but with c++ experience.

[DiscordArchive] Hi. I'm new to AzerothCore but with c++ experience.

rektbyfaith
Administrator
0
03-19-2025, 01:39 PM
#1
Archived author: Bormen • Posted: 2025-03-19T13:39:50.073000+00:00
Original source

Hi. I'm new to AzerothCore but with c++ experience.
While studying the source code, I noticed a thread safety issue: read without synchronization while concurrent write is possible.
https://github.com/azerothcore/azerothco...gr.cpp#L72
Is this such a hot spot that we need to reduce the number of mutex acquisitions here?
[Embed: azerothcore-wotlk/src/server/game/Maps/MapMgr.cpp at master · azero...]
Complete Open Source and Modular solution for MMO. Contribute to azerothcore/azerothcore-wotlk development by creating an account on GitHub.
https://github.com/azerothcore/azerothco...MapMgr.cpp
rektbyfaith
03-19-2025, 01:39 PM #1

Archived author: Bormen • Posted: 2025-03-19T13:39:50.073000+00:00
Original source

Hi. I'm new to AzerothCore but with c++ experience.
While studying the source code, I noticed a thread safety issue: read without synchronization while concurrent write is possible.
https://github.com/azerothcore/azerothco...gr.cpp#L72
Is this such a hot spot that we need to reduce the number of mutex acquisitions here?
[Embed: azerothcore-wotlk/src/server/game/Maps/MapMgr.cpp at master · azero...]
Complete Open Source and Modular solution for MMO. Contribute to azerothcore/azerothcore-wotlk development by creating an account on GitHub.
https://github.com/azerothcore/azerothco...MapMgr.cpp

rektbyfaith
Administrator
0
03-19-2025, 03:41 PM
#2
Archived author: Takenbacon • Posted: 2025-03-19T15:41:31.610000+00:00
Original source

In theory, yes.

In practice it'd be very unlikely to ever be an issue. Base maps are only created once per run time so the odds are astronomically low, but obviously not zero. In the second statement it gets locked and checked again so it could only be a problem the first time it was null. Regardless it's a dumb "optimization" and should be changed
rektbyfaith
03-19-2025, 03:41 PM #2

Archived author: Takenbacon • Posted: 2025-03-19T15:41:31.610000+00:00
Original source

In theory, yes.

In practice it'd be very unlikely to ever be an issue. Base maps are only created once per run time so the odds are astronomically low, but obviously not zero. In the second statement it gets locked and checked again so it could only be a problem the first time it was null. Regardless it's a dumb "optimization" and should be changed

rektbyfaith
Administrator
0
03-19-2025, 03:56 PM
#3
Archived author: Bormen • Posted: 2025-03-19T15:56:30.899000+00:00
Original source

Is it possible that different threads are trying to `CreateBaseMap` with the same ID? In such case the first `FindBaseMap` can read the published map but it has not been initialized yet by another thread because of instructions reordering.
rektbyfaith
03-19-2025, 03:56 PM #3

Archived author: Bormen • Posted: 2025-03-19T15:56:30.899000+00:00
Original source

Is it possible that different threads are trying to `CreateBaseMap` with the same ID? In such case the first `FindBaseMap` can read the published map but it has not been initialized yet by another thread because of instructions reordering.

rektbyfaith
Administrator
0
03-19-2025, 04:02 PM
#4
Archived author: Bormen • Posted: 2025-03-19T16:02:34.383000+00:00
Original source

It is a common issue with double-checked locking pattern.
rektbyfaith
03-19-2025, 04:02 PM #4

Archived author: Bormen • Posted: 2025-03-19T16:02:34.383000+00:00
Original source

It is a common issue with double-checked locking pattern.

rektbyfaith
Administrator
0
03-19-2025, 04:05 PM
#5
Archived author: Diego Silva • Posted: 2025-03-19T16:05:51.184000+00:00
Original source

Hello, I have an error while compiling Azerothcore. How can I fix this? I cannot open the file 'libboost_program_options-vc143-mt-x64-1_78.lib'.
rektbyfaith
03-19-2025, 04:05 PM #5

Archived author: Diego Silva • Posted: 2025-03-19T16:05:51.184000+00:00
Original source

Hello, I have an error while compiling Azerothcore. How can I fix this? I cannot open the file 'libboost_program_options-vc143-mt-x64-1_78.lib'.

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)