Crossfire Server, Branches 1.12
R18729
|
Go to the source code of this file.
Data Structures | |
struct | _MetaServer2_UpdateInfo |
Typedefs | |
typedef struct _MetaServer2_UpdateInfo | MetaServer2_UpdateInfo |
Variables | |
MetaServer2_UpdateInfo | metaserver2_updateinfo |
pthread_mutex_t | ms2_info_mutex |
This file contains metaserver2 information - the metaserver2 implementation requires that a separate thread be used for updates, so a structure to get updated data to the thread is needed.
Definition in file metaserver2.h.
typedef struct _MetaServer2_UpdateInfo MetaServer2_UpdateInfo |
MetaServer2_UpdateInfo metaserver2_updateinfo |
Definition at line 228 of file metaserver.c.
Referenced by metaserver_update().
pthread_mutex_t ms2_info_mutex |
The current implementation of crossfire is not very thread friendly/safe - in fact, metaserver2 is the first part to use an extra thread. As such, it would be a lot of work to add the necessary locks in the rest of the code for the metaserver2 to be able to get the data it needs. So instead, we use this MS2UpdateInfo structure to get the data from the main thread to the metaserver thread - basically, the main thread gets a lock on the mutex, updates the fields in this structure and releases the lock. The metaserver2 thread will get a lock when it needs to get this information, copy it to the post form, then unlock the structure. In that way, neither side holds the lock very long, which is especially important because the metaserver2 thread could take quite a while to do its updates.
Definition at line 226 of file metaserver.c.
Referenced by metaserver_update().