aboutsummaryrefslogtreecommitdiff
path: root/src/clientiface.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2015-04-07 06:13:12 -0400
committerShadowNinja <shadowninja@minetest.net>2015-08-23 22:04:06 -0400
commite4bff8be94c0db4f94e63ad448d0eeb869ccdbbd (patch)
tree7935586e79da5c8c7144e345a8c0fc1cda53beed /src/clientiface.cpp
parent6a1047d8c116f793890b63427d53f04ceca95d54 (diff)
downloadminetest-e4bff8be94c0db4f94e63ad448d0eeb869ccdbbd.tar.gz
minetest-e4bff8be94c0db4f94e63ad448d0eeb869ccdbbd.tar.bz2
minetest-e4bff8be94c0db4f94e63ad448d0eeb869ccdbbd.zip
Clean up threading
* Rename everything. * Strip J prefix. * Change UpperCamelCase functions to lowerCamelCase. * Remove global (!) semaphore count mutex on OSX. * Remove semaphore count getter (unused, unsafe, depended on internal API functions on Windows, and used a hack on OSX). * Add `Atomic<type>`. * Make `Thread` handle thread names. * Add support for C++11 multi-threading. * Combine pthread and win32 sources. * Remove `ThreadStarted` (unused, unneeded). * Move some includes from the headers to the sources. * Move all of `Event` into its header (allows inlining with no new includes). * Make `Event` use `Semaphore` (except on Windows). * Move some porting functions into `Thread`. * Integrate logging with `Thread`. * Add threading test.
Diffstat (limited to 'src/clientiface.cpp')
-rw-r--r--src/clientiface.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/clientiface.cpp b/src/clientiface.cpp
index 3330e0af9..d4efe60ef 100644
--- a/src/clientiface.cpp
+++ b/src/clientiface.cpp
@@ -593,7 +593,7 @@ ClientInterface::~ClientInterface()
Delete clients
*/
{
- JMutexAutoLock clientslock(m_clients_mutex);
+ MutexAutoLock clientslock(m_clients_mutex);
for(std::map<u16, RemoteClient*>::iterator
i = m_clients.begin();
@@ -609,7 +609,7 @@ ClientInterface::~ClientInterface()
std::vector<u16> ClientInterface::getClientIDs(ClientState min_state)
{
std::vector<u16> reply;
- JMutexAutoLock clientslock(m_clients_mutex);
+ MutexAutoLock clientslock(m_clients_mutex);
for(std::map<u16, RemoteClient*>::iterator
i = m_clients.begin();
@@ -660,7 +660,7 @@ void ClientInterface::UpdatePlayerList()
infostream << "* " << player->getName() << "\t";
{
- JMutexAutoLock clientslock(m_clients_mutex);
+ MutexAutoLock clientslock(m_clients_mutex);
RemoteClient* client = lockedGetClientNoEx(*i);
if(client != NULL)
client->PrintInfo(infostream);
@@ -680,7 +680,7 @@ void ClientInterface::send(u16 peer_id, u8 channelnum,
void ClientInterface::sendToAll(u16 channelnum,
NetworkPacket* pkt, bool reliable)
{
- JMutexAutoLock clientslock(m_clients_mutex);
+ MutexAutoLock clientslock(m_clients_mutex);
for(std::map<u16, RemoteClient*>::iterator
i = m_clients.begin();
i != m_clients.end(); ++i) {
@@ -694,7 +694,7 @@ void ClientInterface::sendToAll(u16 channelnum,
RemoteClient* ClientInterface::getClientNoEx(u16 peer_id, ClientState state_min)
{
- JMutexAutoLock clientslock(m_clients_mutex);
+ MutexAutoLock clientslock(m_clients_mutex);
std::map<u16, RemoteClient*>::iterator n;
n = m_clients.find(peer_id);
// The client may not exist; clients are immediately removed if their
@@ -725,7 +725,7 @@ RemoteClient* ClientInterface::lockedGetClientNoEx(u16 peer_id, ClientState stat
ClientState ClientInterface::getClientState(u16 peer_id)
{
- JMutexAutoLock clientslock(m_clients_mutex);
+ MutexAutoLock clientslock(m_clients_mutex);
std::map<u16, RemoteClient*>::iterator n;
n = m_clients.find(peer_id);
// The client may not exist; clients are immediately removed if their
@@ -738,7 +738,7 @@ ClientState ClientInterface::getClientState(u16 peer_id)
void ClientInterface::setPlayerName(u16 peer_id,std::string name)
{
- JMutexAutoLock clientslock(m_clients_mutex);
+ MutexAutoLock clientslock(m_clients_mutex);
std::map<u16, RemoteClient*>::iterator n;
n = m_clients.find(peer_id);
// The client may not exist; clients are immediately removed if their
@@ -749,7 +749,7 @@ void ClientInterface::setPlayerName(u16 peer_id,std::string name)
void ClientInterface::DeleteClient(u16 peer_id)
{
- JMutexAutoLock conlock(m_clients_mutex);
+ MutexAutoLock conlock(m_clients_mutex);
// Error check
std::map<u16, RemoteClient*>::iterator n;
@@ -784,7 +784,7 @@ void ClientInterface::DeleteClient(u16 peer_id)
void ClientInterface::CreateClient(u16 peer_id)
{
- JMutexAutoLock conlock(m_clients_mutex);
+ MutexAutoLock conlock(m_clients_mutex);
// Error check
std::map<u16, RemoteClient*>::iterator n;
@@ -801,7 +801,7 @@ void ClientInterface::CreateClient(u16 peer_id)
void ClientInterface::event(u16 peer_id, ClientStateEvent event)
{
{
- JMutexAutoLock clientlock(m_clients_mutex);
+ MutexAutoLock clientlock(m_clients_mutex);
// Error check
std::map<u16, RemoteClient*>::iterator n;
@@ -823,7 +823,7 @@ void ClientInterface::event(u16 peer_id, ClientStateEvent event)
u16 ClientInterface::getProtocolVersion(u16 peer_id)
{
- JMutexAutoLock conlock(m_clients_mutex);
+ MutexAutoLock conlock(m_clients_mutex);
// Error check
std::map<u16, RemoteClient*>::iterator n;
@@ -838,7 +838,7 @@ u16 ClientInterface::getProtocolVersion(u16 peer_id)
void ClientInterface::setClientVersion(u16 peer_id, u8 major, u8 minor, u8 patch, std::string full)
{
- JMutexAutoLock conlock(m_clients_mutex);
+ MutexAutoLock conlock(m_clients_mutex);
// Error check
std::map<u16, RemoteClient*>::iterator n;