mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
.github
dAuthServer
dChatFilter
dChatServer
dCommon
dDatabase
dGame
dMasterServer
dNavigation
dNet
dPhysics
dScripts
dWorldServer
dZoneManager
docker
docs
migrations
resources
tests
thirdparty
AccountManager
SQLite
cpp-httplib
cpplinq
libbcrypt
mariadb-connector-cpp
raknet
Lib
Source
AsynchronousFileIO.cpp
AsynchronousFileIO.h
AutoRPC.cpp
AutoRPC.h
AutopatcherPatchContext.h
AutopatcherRepositoryInterface.h
BigTypes.h
BitStream.cpp
BitStream.h
BitStream_NoTemplate.cpp
BitStream_NoTemplate.h
CheckSum.cpp
CheckSum.h
ClientContextStruct.h
CommandParserInterface.cpp
CommandParserInterface.h
ConnectionGraph.cpp
ConnectionGraph.h
ConsoleServer.cpp
ConsoleServer.h
DS_BPlusTree.h
DS_BinarySearchTree.h
DS_BytePool.cpp
DS_BytePool.h
DS_ByteQueue.cpp
DS_ByteQueue.h
DS_Heap.h
DS_HuffmanEncodingTree.cpp
DS_HuffmanEncodingTree.h
DS_HuffmanEncodingTreeFactory.h
DS_HuffmanEncodingTreeNode.h
DS_LinkedList.h
DS_List.h
DS_Map.h
DS_MemoryPool.h
DS_OrderedChannelHeap.h
DS_OrderedList.h
DS_Queue.h
DS_QueueLinkedList.h
DS_RangeList.h
DS_Table.cpp
DS_Table.h
DS_Tree.h
DS_WeightedGraph.h
DataBlockEncryptor.cpp
DataBlockEncryptor.h
DataCompressor.cpp
DataCompressor.h
DirectoryDeltaTransfer.cpp
DirectoryDeltaTransfer.h
EmailSender.cpp
EmailSender.h
EncodeClassName.cpp
EpochTimeToString.cpp
EpochTimeToString.h
Export.h
ExtendedOverlappedPool.cpp
ExtendedOverlappedPool.h
FileList.cpp
FileList.h
FileListTransfer.cpp
FileListTransfer.h
FileListTransferCBInterface.h
FileOperations.cpp
FileOperations.h
FormatString.cpp
FormatString.h
FullyConnectedMesh.cpp
FullyConnectedMesh.h
FunctionThread.cpp
FunctionThread.h
Gen_RPC8.cpp
Gen_RPC8.h
GetTime.cpp
GetTime.h
GridSectorizer.cpp
GridSectorizer.h
HTTPConnection.cpp
HTTPConnection.h
InlineFunctor.cpp
InlineFunctor.h
InternalPacket.h
Itoa.cpp
Itoa.h
Kbhit.h
LightweightDatabaseClient.cpp
LightweightDatabaseClient.h
LightweightDatabaseCommon.cpp
LightweightDatabaseCommon.h
LightweightDatabaseServer.cpp
LightweightDatabaseServer.h
LinuxStrings.cpp
LinuxStrings.h
LogCommandParser.cpp
LogCommandParser.h
MTUSize.h
Makefile.am
MessageFilter.cpp
MessageFilter.h
MessageIdentifiers.h
NatPunchthrough.cpp
NatPunchthrough.h
NetworkIDManager.cpp
NetworkIDManager.h
NetworkIDObject.cpp
NetworkIDObject.h
PacketConsoleLogger.cpp
PacketConsoleLogger.h
PacketFileLogger.cpp
PacketFileLogger.h
PacketLogger.cpp
PacketLogger.h
PacketPool.h
PacketPriority.h
PluginInterface.cpp
PluginInterface.h
RPCMap.cpp
RPCMap.h
RPCNode.h
RSACrypt.h
RakAssert.h
RakMemoryOverride.cpp
RakMemoryOverride.h
RakNet.vcproj
RakNet3.0.vcproj
RakNetCommandParser.cpp
RakNetCommandParser.h
RakNetDefines.h
RakNetStatistics.cpp
RakNetStatistics.h
RakNetTransport.cpp
RakNetTransport.h
RakNetTypes.cpp
RakNetTypes.h
RakNetVersion.h
RakNet_vc8.vcproj
RakNetworkFactory.cpp
RakNetworkFactory.h
RakPeer.cpp
RakPeer.h
RakPeerInterface.h
RakSleep.cpp
RakSleep.h
RakString.cpp
RakString.h
RakThread.cpp
RakThread.h
Rand.cpp
Rand.h
ReadyEvent.cpp
ReadyEvent.h
RefCountedObj.h
ReliabilityLayer.cpp
ReliabilityLayer.h
Replica.h
ReplicaEnums.h
ReplicaManager.cpp
ReplicaManager.h
ReplicaManager2.cpp
ReplicaManager2.h
Rijndael-Boxes.h
Rijndael.h
Router.cpp
Router.h
RouterInterface.h
SHA1.cpp
SHA1.h
SimpleMutex.cpp
SimpleMutex.h
SimpleTCPServer.h
SingleProducerConsumer.h
SocketLayer.cpp
SocketLayer.h
StringCompressor.cpp
StringCompressor.h
StringTable.cpp
StringTable.h
SuperFastHash.cpp
SuperFastHash.h
SystemAddressList.cpp
SystemAddressList.h
TCPInterface.cpp
TCPInterface.h
TableSerializer.cpp
TableSerializer.h
TelnetTransport.cpp
TelnetTransport.h
ThreadPool.h
ThreadsafePacketLogger.cpp
ThreadsafePacketLogger.h
TransportInterface.h
Types.h
_FindFirst.cpp
_FindFirst.h
rijndael.cpp
CMakeLists.txt
version.txt
recastnavigation
tinyxml2
CMakeLists.txt
CMakeMariaDBLists.txt
vanity
.dockerignore
.editorconfig
.env.example
.git-blame-ignore-revs
.gitattributes
.gitignore
.gitmodules
CMakeLists.txt
CMakePresets.json
CMakeVariables.txt
CONTRIBUTING.md
Docker.md
Docker_Windows.md
LICENSE
README.md
SECURITY.md
build.sh
docker-compose.yml
logo.png
systemd.example
versions.txt
60 lines
1.9 KiB
C++
60 lines
1.9 KiB
C++
/// \file
|
|
/// \brief \b [Internal] Encapsulates a mutex
|
|
///
|
|
/// This file is part of RakNet Copyright 2003 Kevin Jenkins.
|
|
///
|
|
/// Usage of RakNet is subject to the appropriate license agreement.
|
|
/// Creative Commons Licensees are subject to the
|
|
/// license found at
|
|
/// http://creativecommons.org/licenses/by-nc/2.5/
|
|
/// Single application licensees are subject to the license found at
|
|
/// http://www.jenkinssoftware.com/SingleApplicationLicense.html
|
|
/// Custom license users are subject to the terms therein.
|
|
/// GPL license users are subject to 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.
|
|
|
|
#ifndef __SIMPLE_MUTEX_H
|
|
#define __SIMPLE_MUTEX_H
|
|
|
|
#include "RakMemoryOverride.h"
|
|
#ifdef _XBOX360
|
|
#include "Console1Includes.h"
|
|
#elif defined(_WIN32)
|
|
#include <windows.h>
|
|
#else
|
|
#include <pthread.h>
|
|
#include <sys/types.h>
|
|
#endif
|
|
#include "Export.h"
|
|
/// \brief An easy to use mutex.
|
|
///
|
|
/// I wrote this because the version that comes with Windows is too complicated and requires too much code to use.
|
|
/// @remark Previously I used this everywhere, and in fact for a year or two RakNet was totally threadsafe. While doing profiling, I saw that this function was incredibly slow compared to the blazing performance of everything else, so switched to single producer / consumer everywhere. Now the user thread of RakNet is not threadsafe, but it's 100X faster than before.
|
|
class RAK_DLL_EXPORT SimpleMutex : public RakNet::RakMemoryOverride
|
|
{
|
|
public:
|
|
|
|
/// Constructor
|
|
SimpleMutex();
|
|
|
|
// Destructor
|
|
~SimpleMutex();
|
|
|
|
// Locks the mutex. Slow!
|
|
void Lock(void);
|
|
|
|
// Unlocks the mutex.
|
|
void Unlock(void);
|
|
private:
|
|
#ifdef _WIN32
|
|
CRITICAL_SECTION criticalSection; /// Docs say this is faster than a mutex for single process access
|
|
#else
|
|
pthread_mutex_t hMutex;
|
|
#endif
|
|
};
|
|
|
|
#endif
|
|
|