// Schedule an update to happen after all the regular taints are processed. // Note that new requests for the same operation ("ident") for the same object ("ID") // will replace any previous operation by the same object. public void PostTaintObject(String ident, uint ID, TaintCallback callback) { string uniqueIdent = ident + "-" + ID.ToString(); lock (_taintLock) { _postTaintOperations[uniqueIdent] = new TaintCallbackEntry(uniqueIdent, callback); } return; }
// Schedule an update to happen after all the regular taints are processed. // Note that new requests for the same operation ("ident") for the same object ("ID") // will replace any previous operation by the same object. public void PostTaintObject(String ident, uint ID, TaintCallback callback) { string IDAsString = ID.ToString(); string uniqueIdent = ident + "-" + IDAsString; lock (_taintLock) { _postTaintOperations[uniqueIdent] = new TaintCallbackEntry(IDAsString, uniqueIdent, callback); } return; }
// When someone tries to change a property on a BSPrim or BSCharacter, the object queues // a callback into itself to do the actual property change. That callback is called // here just before the physics engine is called to step the simulation. public void ProcessTaints() { if (_taintedObjects.Count > 0) // save allocating new list if there is nothing to process { int taintCount = m_taintsToProcessPerStep; TaintCallbackEntry oneCallback = new TaintCallbackEntry(); while (_taintedObjects.Count > 0 && taintCount-- > 0) { bool gotOne = false; lock (_taintLock) { if (_taintedObjects.Count > 0) { oneCallback = _taintedObjects[0]; _taintedObjects.RemoveAt(0); gotOne = true; } } if (gotOne) { try { DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", DetailLogZero, oneCallback.ident); oneCallback.callback(); } catch (Exception e) { DetailLog("{0},BSScene.ProcessTaints,doTaintException,id={1}", DetailLogZero, oneCallback.ident); // DEBUG DEBUG DEBUG m_log.ErrorFormat("{0}: ProcessTaints: {1}: Exception: {2}", LogHeader, oneCallback.ident, e); } } } /* // swizzle a new list into the list location so we can process what's there List<TaintCallbackEntry> oldList; lock (_taintLock) { oldList = _taintedObjects; _taintedObjects = new List<TaintCallbackEntry>(); } foreach (TaintCallbackEntry tcbe in oldList) { try { DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", DetailLogZero, tcbe.ident); // DEBUG DEBUG DEBUG tcbe.callback(); } catch (Exception e) { m_log.ErrorFormat("{0}: ProcessTaints: {1}: Exception: {2}", LogHeader, tcbe.ident, e); } } oldList.Clear(); */ } }