TrinityCore
Loading...
Searching...
No Matches
MapUpdater Class Reference

#include <MapUpdater.h>

Public Member Functions

 MapUpdater ()
 
 ~MapUpdater ()
 
void schedule_update (Map &map, uint32 diff)
 
void wait ()
 
void activate (size_t num_threads)
 
void deactivate ()
 
bool activated () const
 

Private Member Functions

void update_finished ()
 
void WorkerThread ()
 

Private Attributes

ProducerConsumerQueue< MapUpdateRequest * > _queue
 
std::vector< std::thread > _workerThreads
 
std::atomic< bool > _cancelationToken
 
std::mutex _lock
 
std::condition_variable _condition
 
size_t pending_requests
 

Friends

class MapUpdateRequest
 

Detailed Description

Definition at line 31 of file MapUpdater.h.

Constructor & Destructor Documentation

◆ MapUpdater()

MapUpdater::MapUpdater ( )
inline

Definition at line 35 of file MapUpdater.h.

◆ ~MapUpdater()

MapUpdater::~MapUpdater ( )
inline

Definition at line 36 of file MapUpdater.h.

Member Function Documentation

◆ activate()

void MapUpdater::activate ( size_t  num_threads)

Definition at line 46 of file MapUpdater.cpp.

References _workerThreads, and WorkerThread().

Referenced by MapManager::Initialize().

◆ activated()

bool MapUpdater::activated ( ) const

Definition at line 80 of file MapUpdater.cpp.

References _workerThreads.

Referenced by MapManager::UnloadAll(), and MapManager::Update().

◆ deactivate()

void MapUpdater::deactivate ( )

◆ schedule_update()

void MapUpdater::schedule_update ( Map &  map,
uint32  diff 
)

◆ update_finished()

void MapUpdater::update_finished ( )
private

Definition at line 85 of file MapUpdater.cpp.

References _condition, _lock, and pending_requests.

Referenced by MapUpdateRequest::call().

◆ wait()

void MapUpdater::wait ( )

Definition at line 64 of file MapUpdater.cpp.

References _condition, _lock, and pending_requests.

Referenced by deactivate(), and MapManager::Update().

◆ WorkerThread()

void MapUpdater::WorkerThread ( )
private

Friends And Related Symbol Documentation

◆ MapUpdateRequest

friend class MapUpdateRequest
friend

Definition at line 38 of file MapUpdater.h.

Referenced by schedule_update().

Member Data Documentation

◆ _cancelationToken

std::atomic<bool> MapUpdater::_cancelationToken
private

Definition at line 55 of file MapUpdater.h.

Referenced by deactivate(), and WorkerThread().

◆ _condition

std::condition_variable MapUpdater::_condition
private

Definition at line 58 of file MapUpdater.h.

Referenced by update_finished(), and wait().

◆ _lock

std::mutex MapUpdater::_lock
private

Definition at line 57 of file MapUpdater.h.

Referenced by schedule_update(), update_finished(), and wait().

◆ _queue

ProducerConsumerQueue<MapUpdateRequest*> MapUpdater::_queue
private

Definition at line 52 of file MapUpdater.h.

Referenced by deactivate(), schedule_update(), and WorkerThread().

◆ _workerThreads

std::vector<std::thread> MapUpdater::_workerThreads
private

Definition at line 54 of file MapUpdater.h.

Referenced by activate(), activated(), and deactivate().

◆ pending_requests

size_t MapUpdater::pending_requests
private

Definition at line 59 of file MapUpdater.h.

Referenced by schedule_update(), update_finished(), and wait().


The documentation for this class was generated from the following files: