public RemotelyInitializedTransactionHandler CreateAndRegisterRITransactionHandler( uint transactionId, byte opcode) { RemotelyInitializedTransactionHandler riTh = null; for (int i = 0; i < m_instructionSets.Count && riTh == null; i++) { var instructionSet = m_instructionSets[i]; instructionSet.TryCreateRemotelyInitializedTransactionHandler(opcode, transactionId, out riTh); } if (riTh == null) { m_node.TryCreateRemotelyInitializedTransactionHandler(opcode, transactionId, out riTh); } if (riTh == null) { throw new KeyNotFoundException("No instruction set supported opcode " + opcode); } // Register the RIT Handler m_riTransactions.AddOrUpdate(riTh.TransactionID, riTh, (key, existingValue) => { throw new InvalidOperationException("RITH TID already existed in concurrent dict!"); }); return(riTh); }
public void DeregisterRITransactionHandler(RemotelyInitializedTransactionHandler handler) { RemotelyInitializedTransactionHandler removedRith = null; while (removedRith == null) { m_riTransactions.TryRemove(handler.TransactionID, out removedRith); } Trace.Assert(handler == removedRith); }
public RemotelyInitializedTransactionHandler CreateAndRegisterRITransactionHandler( uint transactionId, byte opcode) { RemotelyInitializedTransactionHandler riTh = null; for (int i = 0; i < m_instructionSets.Count && riTh == null; i++) { var instructionSet = m_instructionSets[i]; var handlerType = instructionSet.GetRemotelyInitializedTransactionHandlerType(opcode); if (handlerType != null) { if (!instructionSet.UseConstructionContext) { riTh = (RemotelyInitializedTransactionHandler)Activator.CreateInstance( handlerType, transactionId ); } else { riTh = (RemotelyInitializedTransactionHandler)Activator.CreateInstance( handlerType, transactionId, instructionSet.ConstructionContext ); } } } if (riTh == null) { var handlerType = m_node.GetRITOpcodeHandlerType(opcode); if (handlerType != null) { riTh = (RemotelyInitializedTransactionHandler)Activator.CreateInstance( handlerType, transactionId ); } } if (riTh == null) { throw new KeyNotFoundException("No instruction set supported opcode " + opcode); } // Register the RIT Handler m_riTransactions.AddOrUpdate(riTh.TransactionID, riTh, (key, existingValue) => { throw new InvalidOperationException("RITH TID already existed in concurrent dict!"); }); return(riTh); }
public bool TryCreateRemotelyInitializedTransactionHandler(byte opcode, uint transactionId, out RemotelyInitializedTransactionHandler handler) { foreach (var instructionSet in m_instructionSets) { if (instructionSet.TryCreateRemotelyInitializedTransactionHandler(opcode, transactionId, out handler)) { return(true); } } handler = null; return(false); }
public bool TryCreateRemotelyInitializedTransactionHandler(byte opcode, uint transactionId, out RemotelyInitializedTransactionHandler handler) { handler = null; switch ((DTP)opcode) { case DTP.ECHO: handler = new EchoRith(transactionId); break; } return(handler != null); }