コード例 #1
0
 public ulong AddProblem(ProblemDefinition def)
 {
     lock (lockObj)
     {
         var id = counter++;
         logger.Info($"Adding new problem of type {def.Type} and id {id}.");
         problems.Add(id, new Problem(id, def));
         return(id);
     }
 }
コード例 #2
0
 public void AddProblem(ProblemDefinition def, ulong forcedId)
 {
     lock (lockObj)
     {
         // TODO: detect why we have two messages in the queue!
         if (!problems.ContainsKey(forcedId))
         {
             logger.Info($"Adding new problem of type {def.Type} and id {forcedId}.");
             problems.Add(forcedId, new Problem(forcedId, def));
             counter = Math.Max(counter, forcedId + 1);
         }
     }
 }
コード例 #3
0
 public Problem(ulong id, ProblemDefinition def)
 {
     Id   = id;
     Type = def.Type;
     Data = def.Data;
 }