summaryrefslogtreecommitdiffstats
path: root/src/Server.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Server.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Server.h b/src/Server.h
index 3d272d7c0..7701faa69 100644
--- a/src/Server.h
+++ b/src/Server.h
@@ -105,6 +105,9 @@ public:
The command's output will be written to the a_Output callback. */
void QueueExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output);
+ /** Queues a lambda task onto the server tick thread, with the specified delay in ticks. */
+ void ScheduleTask(cTickTime a_DelayTicks, std::function<void(class cServer &)> a_Task);
+
/** Lists all available console commands and their helpstrings */
void PrintHelp(const AStringVector & a_Split, cCommandOutputCallback & a_Output);
@@ -245,6 +248,18 @@ private:
AStringVector m_Ports;
+ /** Time, in ticks, since the server started
+ Not persistent across server restarts */
+ cTickTimeLong m_UpTime;
+
+ /** Guards the m_Tasks */
+ cCriticalSection m_CSTasks;
+
+ /** Tasks that have been queued onto the tick thread, possibly to be
+ executed at target tick in the future; guarded by m_CSTasks */
+ std::vector<std::pair<std::chrono::milliseconds, std::function<void(class cServer &)>>> m_Tasks;
+
+
cServer(void);
/** Executes the console command, sends output through the specified callback. */
@@ -268,6 +283,11 @@ private:
/** Executes commands queued in the command queue. */
void TickCommands(void);
+
+ /** Executes all tasks queued onto the tick thread */
+ void TickQueuedTasks(void);
+
+
}; // tolua_export