mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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.
This commit is contained in:
parent
6a1047d8c1
commit
e4bff8be94
77 changed files with 1594 additions and 2046 deletions
|
@ -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<u32, ParticleSpawner*>::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<Particle*>::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<u32, ParticleSpawner*>::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<u32, ParticleSpawner*>(
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue