Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
EmergeThread Class Reference

#include <emerge_internal.h>

+ Inheritance diagram for EmergeThread:
+ Collaboration diagram for EmergeThread:

Public Member Functions

 EmergeThread (Server *server, int ethreadid)
 
 ~EmergeThread ()=default
 
void * run ()
 
void signal ()
 
bool pushBlock (v3s16 pos)
 
void cancelPendingItems ()
 
EmergeManagergetEmergeManager ()
 
MapgengetMapgen ()
 
- Public Member Functions inherited from Thread
 Thread (const std::string &name="")
 
virtual ~Thread ()
 
bool start ()
 
bool stop ()
 
bool wait ()
 
bool isCurrentThread ()
 
bool isRunning ()
 
bool stopRequested ()
 
std::thread::id getThreadId ()
 
bool getReturnValue (void **ret)
 
bool bindToProcessor (unsigned int proc_number)
 
bool setPriority (int prio)
 

Public Attributes

bool enable_mapgen_debug_info
 
const int id
 

Protected Member Functions

void runCompletionCallbacks (v3s16 pos, EmergeAction action, const EmergeCallbackList &callbacks)
 

Private Member Functions

bool initScripting ()
 
bool popBlockEmerge (v3s16 *pos, BlockEmergeData *bedata)
 
EmergeAction getBlockOrStartGen (v3s16 pos, bool allow_gen, const std::string *from_db, MapBlock **block, BlockMakeData *data)
 Try to get a block from memory and decide what to do.
 
MapBlockfinishGen (v3s16 pos, BlockMakeData *bmdata, std::map< v3s16, MapBlock * > *modified_blocks)
 

Private Attributes

Serverm_server
 
ServerMapm_map
 
EmergeManagerm_emerge
 
Mapgenm_mapgen
 
std::unique_ptr< EmergeScriptingm_script
 
UniqueQueue< v3s16 > * m_trans_liquid
 
Event m_queue_event
 
std::queue< v3s16m_block_queue
 

Friends

class EmergeManager
 
class EmergeScripting
 
class ModApiMapgen
 

Additional Inherited Members

- Static Public Member Functions inherited from Thread
static ThreadgetCurrentThread ()
 
static void setName (const std::string &name)
 
static unsigned int getNumberOfProcessors ()
 
- Protected Attributes inherited from Thread
std::string m_name
 

Constructor & Destructor Documentation

◆ EmergeThread()

EmergeThread::EmergeThread ( Server * server,
int ethreadid )

References itos(), and Thread::m_name.

+ Here is the call graph for this function:

◆ ~EmergeThread()

EmergeThread::~EmergeThread ( )
default

Member Function Documentation

◆ cancelPendingItems()

void EmergeThread::cancelPendingItems ( )

References BlockEmergeData::callbacks, EMERGE_CANCELLED, m_block_queue, m_emerge, EmergeManager::m_queue_mutex, EmergeManager::popBlockEmergeData(), and runCompletionCallbacks().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ finishGen()

MapBlock * EmergeThread::finishGen ( v3s16 pos,
BlockMakeData * bmdata,
std::map< v3s16, MapBlock * > * modified_blocks )
private

References ServerEnvironment::activateBlock(), analyze_block(), BlockMakeData::blockpos_max, BlockMakeData::blockpos_min, Mapgen::blockseed, GenerateNotifier::clearEvents(), EMERGE_DBG_OUT, ScriptApiEnv::environment_OnGenerated(), errorstream, ServerMap::finishBlockMake(), g_profiler, Mapgen::generating, Mapgen::gennotify, Map::getBlockNoCreateNoEx(), Server::getScriptIface(), Server::m_env, Server::m_ignore_map_edit_events_area, m_map, m_mapgen, m_server, MAP_BLOCKSIZE, Server::setAsyncFatalError(), SPT_AVG, and Mapgen::vm.

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBlockOrStartGen()

EmergeAction EmergeThread::getBlockOrStartGen ( v3s16 pos,
bool allow_gen,
const std::string * from_db,
MapBlock ** block,
BlockMakeData * data )
private

Try to get a block from memory and decide what to do.

Parameters
posblock position
from_dbserialized block data, optional (for second call after EMERGE_FROM_DISK was returned)
allow_genallow invoking mapgen?
blockoutput pointer for block
datainfo for mapgen
Returns
what to do for this block

References EMERGE_CANCELLED, EMERGE_FROM_DISK, EMERGE_FROM_MEMORY, EMERGE_GENERATED, Map::getBlockNoCreateNoEx(), ServerMap::initBlockMake(), ServerMap::loadBlock(), m_map, m_server, and verbosestream.

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEmergeManager()

EmergeManager * EmergeThread::getEmergeManager ( )
inline

References m_emerge.

◆ getMapgen()

Mapgen * EmergeThread::getMapgen ( )
inline

References m_mapgen.

◆ initScripting()

bool EmergeThread::initScripting ( )
private

References BUILTIN_MOD_NAME, ScriptApiBase::checkSetByBuiltin(), DIR_DELIM, errorstream, Server::getBuiltinLuaPath(), ScriptApiBase::loadMod(), Server::m_mapgen_init_files, m_script, m_server, ScriptApiMapgen::on_mods_loaded(), Server::setAsyncFatalError(), and BaseException::what().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ popBlockEmerge()

bool EmergeThread::popBlockEmerge ( v3s16 * pos,
BlockEmergeData * bedata )
private

References m_block_queue, m_emerge, EmergeManager::m_queue_mutex, and EmergeManager::popBlockEmergeData().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pushBlock()

bool EmergeThread::pushBlock ( v3s16 pos)

References m_block_queue.

Referenced by EmergeManager::enqueueBlockEmergeEx().

+ Here is the caller graph for this function:

◆ run()

◆ runCompletionCallbacks()

void EmergeThread::runCompletionCallbacks ( v3s16 pos,
EmergeAction action,
const EmergeCallbackList & callbacks )
protected

References m_emerge, and EmergeManager::reportCompletedEmerge().

Referenced by cancelPendingItems(), and run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ signal()

void EmergeThread::signal ( )

References m_queue_event, and Event::signal().

Referenced by EmergeManager::~EmergeManager(), and EmergeManager::enqueueBlockEmergeEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ EmergeManager

friend class EmergeManager
friend

◆ EmergeScripting

friend class EmergeScripting
friend

◆ ModApiMapgen

friend class ModApiMapgen
friend

Member Data Documentation

◆ enable_mapgen_debug_info

bool EmergeThread::enable_mapgen_debug_info

Referenced by run().

◆ id

const int EmergeThread::id

Referenced by run().

◆ m_block_queue

std::queue<v3s16> EmergeThread::m_block_queue
private

◆ m_emerge

◆ m_map

ServerMap* EmergeThread::m_map
private

Referenced by finishGen(), getBlockOrStartGen(), and run().

◆ m_mapgen

Mapgen* EmergeThread::m_mapgen
private

◆ m_queue_event

Event EmergeThread::m_queue_event
private

Referenced by run(), and signal().

◆ m_script

std::unique_ptr<EmergeScripting> EmergeThread::m_script
private

Referenced by initScripting(), and run().

◆ m_server

Server* EmergeThread::m_server
private

◆ m_trans_liquid

UniqueQueue<v3s16>* EmergeThread::m_trans_liquid
private

Referenced by run().


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