1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-30 15:06:38 +02:00

- Added EventMarkDel which marks an event for deletion for the (next) DoEvents() call.

- Fixed /rehash stall caused by delayed unloading of the scan module (deadlock).
This commit is contained in:
Bram Matthys
2003-02-24 03:04:23 +00:00
parent 99ee86c9c9
commit 60b77d4485
4 changed files with 18 additions and 4 deletions
+11 -1
View File
@@ -94,6 +94,12 @@ Event *EventAddEx(Module *module, char *name, long every, long howmany,
}
Event *EventMarkDel(Event *event)
{
event->howmany = -1;
return event;
}
Event *EventDel(Event *event)
{
Event *p, *q;
@@ -154,6 +160,9 @@ inline void DoEvents(void)
Event temp;
for (eventptr = events; eventptr; eventptr = eventptr->next)
{
if (eventptr->howmany == -1)
goto freeit;
if ((eventptr->every == 0) || ((TStime() - eventptr->last) >= eventptr->every))
{
eventptr->last = TStime();
@@ -163,13 +172,14 @@ inline void DoEvents(void)
eventptr->howmany--;
if (eventptr->howmany == 0)
{
freeit:
temp.next = EventDel(eventptr);
eventptr = &temp;
continue;
}
}
}
}
}
void EventStatus(aClient *sptr)
+2 -3
View File
@@ -176,9 +176,8 @@ int m_scan_Unload(void)
HookDel(ConfRun);
HookDel(ConfPostTest);
HookDel(ServerStats);
LockEventSystem();
EventDel(Scannings_clean);
UnlockEventSystem();
/* Mark for deletion */
EventMarkDel(Scannings_clean);
IRCMutexDestroy(Scannings_lock);
if (scan_message)
free(scan_message);