summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 37580b6..08ad642 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -720,8 +720,20 @@ void mmo_char_sync(void) {
// Function to save (in a periodic way) datas in files
//----------------------------------------------------
int mmo_char_sync_timer(int tid, unsigned int tick, int id, int data) {
+ pid_t pid;
+
+ // This can take a lot of time. Fork a child to handle the work and return at once
+ // If we're unable to fork just continue running the function normally
+ if ((pid = fork()) > 0)
+ return 0;
+
mmo_char_sync();
inter_save();
+
+ // If we're a child we should suicide now.
+ if (pid == 0)
+ exit(0);
+
return 0;
}