Per-map threads and per-player threads
Mutex locks in players, and in ‘map queues’.
One map thread when wanting to do something such as teleport an object to another map, get a lock on the map’s queue and put it in a queue of things for the other map thread to do in it’s next tick.
In order to avoid all chance of deadlock, do this when processing the queue of things other threads told the thread to do:
Lock it’s queue
Copy it’s queue and clear the original
Unlock it’s queue
Process the copy of the queue.
Otherwise, there is a small chance that two processing queues at the same time might want to lock eachother to add to the list.
Alternatively one could do per-query-entry locking, however that wouldn’t work with a linked list, plus that much locking and unlocking may become expensive on cpu
-
I consider this to be a very low priority thing, however made the wiki page here to make sure some ideas about implementing it are not lost —
Alex Schultz 2006/10/09 11:15
put information from the logs of IRC discussion here