/// <summary>Before calling FlipOver() this thread should not hold any checked out items. </summary> public void FlipOver() { FullBrief tempA = capturingBrief; //log.Trace("FlipOver Called\n 1/4 capturingLock: ON -> from " + methodBase.Name ); System.Threading.Monitor.Enter(capturingLock);//same as lock() //log.Trace("...Done\n"); //log.Trace(" 2/4 processingLock: ON"); System.Threading.Monitor.Enter(processingLock); //log.Trace("...Done\n"); capturingBrief = processingBrief; processingBrief = tempA; //log.Trace(" 3/4 processingLock: OFF"); System.Threading.Monitor.Exit(processingLock); //log.Trace("...Done\n"); //log.Trace(" 4/4 capturingLock: OFF"); System.Threading.Monitor.Exit(capturingLock); //log.Trace("...Done\n"); //log.Trace("FlipOver Call complete\n"); }
/// <summary> /// Initialize the BriefCoin. One side of the coin processes the briefs and while the other finishes a brief and upload it. /// </summary> /// <param name="symbolCt">The number of symbols.</param> /// <param name="indexes">An Array of market indexes that will be stored.</param> /// <param name="mostRecentBrief">The most recent brief in database. Use null if this will be the first row in the database.</param> public BriefCoin(int symbolCt, Index[] indexes, byte[] mostRecentBrief = null) { capturingBrief = new FullBrief(symbolCt, indexes, mostRecentBrief); processingBrief = new FullBrief(symbolCt, indexes, mostRecentBrief); //log = NLog.LogManager.GetCurrentClassLogger(); }