Well I just added it directly into lockfree.h
Here's my code copy and pasted directly, if you want an actual screenshot just let me know:
Code:
/**
* The Forgotten Server - a free and open-source MMORPG server emulator
* Copyright (C) 2016 Mark Samman <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef FS_LOCKFREE_H_8C707AEB7C7235A2FBC5D4EDDF03B008
#define FS_LOCKFREE_H_8C707AEB7C7235A2FBC5D4EDDF03B008
#if _MSC_FULL_VER == 190023918 // Workaround for VS2015 Update 2. Boost.Lockfree is a header-only library, so this should be safe to do.
#define _ENABLE_ATOMIC_ALIGNMENT_FIX
#endif
#include <boost/lockfree/stack.hpp>
template <typename T, size_t CAPACITY>
class LockfreePoolingAllocator : public std::allocator<T>
{
public:
template <typename U>
explicit LockfreePoolingAllocator(const U&) {}
typedef T value_type;
T* allocate(size_t) const {
T* p; // NOTE: p doesn't have to be initialized
if (!getFreeList().pop(p)) {
//Acquire memory without calling the constructor of T
p = static_cast<T*>(operator new (sizeof(T)));
}
return p;
}
void deallocate(T* p, size_t) const {
if (!getFreeList().bounded_push(p)) {
//Release memory without calling the destructor of T
//(it has already been called at this point)
operator delete(p);
}
}
private:
typedef boost::lockfree::stack<T*, boost::lockfree::capacity<CAPACITY>> FreeList;
static FreeList& getFreeList() {
static FreeList freeList;
return freeList;
}
};
#endif
EIDT:
I tried again, got a different result:
1>------ Rebuild All started: Project: theforgottenserver, Configuration: Release x64 ------
1> otpch.cpp
1> actions.cpp
1> ban.cpp
1> baseevents.cpp
1> bed.cpp
1> chat.cpp
1> combat.cpp
1> commands.cpp
1> condition.cpp
1> configmanager.cpp
1> connection.cpp
1> container.cpp
1> creature.cpp
1> creatureevent.cpp
1> cylinder.cpp
1> database.cpp
1> databasemanager.cpp
1> databasetasks.cpp
1> depotchest.cpp
1> depotlocker.cpp
1> events.cpp
1> fileloader.cpp
1> game.cpp
1> globalevent.cpp
1> groups.cpp
1>..\src\game.cpp(3409): warning C4189: 'targetPlayer': local variable is initialized but not referenced
1> guild.cpp
1> house.cpp
1> housetile.cpp
1> ioguild.cpp
1> iologindata.cpp
1> iomap.cpp
1> iomapserialize.cpp
1> item.cpp
1> items.cpp
1> luascript.cpp
1> mailbox.cpp
1> map.cpp
1> monster.cpp
1> monsters.cpp
1> movement.cpp
1> networkmessage.cpp
1> npc.cpp
1> otserv.cpp
1> outputmessage.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\atomic(659): error C2338: You've instantiated std::atomic<T> with sizeof(T) equal to 2/4/8 and alignof(T) < sizeof(T). Before VS 2015 Update 2, this would have misbehaved at runtime. VS 2015 Update 2 was fixed to handle this correctly, but the fix inherently changes layout and breaks binary compatibility. Please define _ENABLE_ATOMIC_ALIGNMENT_FIX to acknowledge that you understand this, and that everything you're linking has been compiled with VS 2015 Update 2 (or later). (compiling source file ..\src\outputmessage.cpp)
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\atomic(669): note: see reference to class template instantiation 'std::_Atomic_base<_Ty,4>' being compiled
1> with
1> [
1> _Ty=boost::lockfree::detail::tagged_index
1> ] (compiling source file ..\src\outputmessage.cpp)
1> C:\local\boost_1_61_0\boost/lockfree/detail/freelist.hpp(608): note: see reference to class template instantiation 'std::atomic<boost::lockfree::detail::tagged_index>' being compiled (compiling source file ..\src\outputmessage.cpp)
1> C:\local\boost_1_61_0\boost/lockfree/detail/freelist.hpp(609): note: see reference to class template instantiation 'boost::lockfree::detail::fixed_size_freelist<T,NodeStorage>' being compiled (compiling source file ..\src\outputmessage.cpp)
1> party.cpp
1> player.cpp
1>..\src\player.cpp(680): warning C4100: 'isLogin': unreferenced formal parameter
1> position.cpp
1> protocol.cpp
1> protocolgame.cpp
1> protocollogin.cpp
1> protocolstatus.cpp
1> raids.cpp
1>..\src\protocolgame.cpp(1724): warning C4063: case '2' is not a valid value for switch of enum 'PlayerSex_t'
1> c:\tfs1.2(7.4)\src\enums.h(266): note: see declaration of 'PlayerSex_t'
1> rsa.cpp
1> scheduler.cpp
1> scriptmanager.cpp
1> server.cpp
1> spawn.cpp
1> spells.cpp
1> talkaction.cpp
1> tasks.cpp
1> teleport.cpp
1> thing.cpp
1> tile.cpp
1> tools.cpp
1> trashholder.cpp
1> vocation.cpp
1> waitlist.cpp
1> weapons.cpp
1> wildcardtree.cpp
1>..\src\weapons.cpp(143): warning C4100: 'level': unreferenced formal parameter
1>..\src\weapons.cpp(148): warning C4100: 'level': unreferenced formal parameter
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========