From e4bff8be94c0db4f94e63ad448d0eeb869ccdbbd Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Tue, 7 Apr 2015 06:13:12 -0400 Subject: 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`. * 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. --- src/particles.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/particles.cpp') diff --git a/src/particles.cpp b/src/particles.cpp index 15e2a6597..ab48bae9e 100644 --- a/src/particles.cpp +++ b/src/particles.cpp @@ -347,7 +347,7 @@ void ParticleManager::step(float dtime) void ParticleManager::stepSpawners (float dtime) { - JMutexAutoLock lock(m_spawner_list_lock); + MutexAutoLock lock(m_spawner_list_lock); for(std::map::iterator i = m_particle_spawners.begin(); i != m_particle_spawners.end();) @@ -367,7 +367,7 @@ void ParticleManager::stepSpawners (float dtime) void ParticleManager::stepParticles (float dtime) { - JMutexAutoLock lock(m_particle_list_lock); + MutexAutoLock lock(m_particle_list_lock); for(std::vector::iterator i = m_particles.begin(); i != m_particles.end();) { @@ -387,8 +387,8 @@ void ParticleManager::stepParticles (float dtime) void ParticleManager::clearAll () { - JMutexAutoLock lock(m_spawner_list_lock); - JMutexAutoLock lock2(m_particle_list_lock); + MutexAutoLock lock(m_spawner_list_lock); + MutexAutoLock lock2(m_particle_list_lock); for(std::map::iterator i = m_particle_spawners.begin(); i != m_particle_spawners.end();) @@ -411,7 +411,7 @@ void ParticleManager::handleParticleEvent(ClientEvent *event, IGameDef *gamedef, scene::ISceneManager* smgr, LocalPlayer *player) { if (event->type == CE_DELETE_PARTICLESPAWNER) { - JMutexAutoLock lock(m_spawner_list_lock); + MutexAutoLock lock(m_spawner_list_lock); if (m_particle_spawners.find(event->delete_particlespawner.id) != m_particle_spawners.end()) { @@ -425,7 +425,7 @@ void ParticleManager::handleParticleEvent(ClientEvent *event, IGameDef *gamedef, if (event->type == CE_ADD_PARTICLESPAWNER) { { - JMutexAutoLock lock(m_spawner_list_lock); + MutexAutoLock lock(m_spawner_list_lock); if (m_particle_spawners.find(event->add_particlespawner.id) != m_particle_spawners.end()) { @@ -465,7 +465,7 @@ void ParticleManager::handleParticleEvent(ClientEvent *event, IGameDef *gamedef, delete event->add_particlespawner.maxacc; { - JMutexAutoLock lock(m_spawner_list_lock); + MutexAutoLock lock(m_spawner_list_lock); m_particle_spawners.insert( std::pair( event->add_particlespawner.id, @@ -568,6 +568,6 @@ void ParticleManager::addNodeParticle(IGameDef* gamedef, scene::ISceneManager* s void ParticleManager::addParticle(Particle* toadd) { - JMutexAutoLock lock(m_particle_list_lock); + MutexAutoLock lock(m_particle_list_lock); m_particles.push_back(toadd); } -- cgit v1.2.3