This is to avoid a complicated tri-thread deadlock on region crossing for avatars with attachments, where
1) XEngine starting up scripts can lock XEngine.m_Scripts and then try to lock OdeScene._collisionEventPrim while starting up a script due to avatar border crossing
2) An existing collision event will lock OdeScene._collisionEventPrim and then try to lock SP.m_attachments while trying to send the collision event to attachments
3) The avatar still entering the region will lock SP.m_attachments and then try to lock m_Scripts to start more attachment scripts.
Executing this asynchronously allows a race condition where subsequent friends fetches hit a cache that FetchFriendsList() had not yet populated.
Changing this to synchronous may improve issues where a user does not see friends as online even though they are.
I don't believe synchronous is a problem here, but if it is, then a more complicated signalling mechanism is required. Locking the cache isn't sufficient.
prim update to only triple queuing. Existing method was:
1. Schedule prim for update, adding to scene update list
2. Update on SOGs during heartbeat queues update onto each SceneViewer
3. Update on SPs during heartbeat queues update onto each IClientAPI
4. ProcessEntityUpdates queues updates into UDP send stack
Now the SceneViewer has been eliminated so updates are scheduled at any
time and then put onto the IClientAPI priority queues immediately during
SceneGraph.UpdateObjectGroups.
This is to avoid http://opensimulator.org/mantis/view.php?id=5783 when a collision with a ground sitting avatar causes that avatar to automatically stand and sometimes not be able to move
A better solution may be to keep gound sitting avatars solid but remove their collision status. However, this requires some physics code work.
OutPacket() must be called within the m_killRecord lock. Otherwise the following event sequence is possible
1) LLClientView.ProcessEntityUpdates() passes the kill record check for a particular part suspends before OutPacket()
2) Another thread calls LLClientView.SendKillObject() to delete the same part and modifies the kill record
3) The same thread places the kill packet on the Task queue.
4) The earlier thread resumes and places the update packet on the Task queue after the kill packet.
This results in a ghost part in the sim that only goes away after client relog.
This commit also removes the unnecessary m_entityUpdates.SyncRoot locking in SendKillObject.
This means that if the avatar is within 10 meters of the selected target, it sits on it immediately without walking.
Existing autopilot outside this range will be disabled in a later commit