Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. 1: private bool extractWriteActions(out List<WriteChannel> channelWrites)
  2. 2: {
  3. 3: channelWrites = new List<WriteChannel>();
  4. 4: foreach (TpotAction action in tpotActionQueue)
  5. 5: {
  6. 6: if (action is WriteChannel)
  7. 7: {
  8. 8: channelWrites.Add((WriteChannel)action);
  9. 9: lock(tpotActionQueue)
  10. 10: {
  11. 11: action.Status = RecordStatus.Batched;
  12. 12: }
  13. 13: }
  14. 14: }
  15. 15: return (channelWrites.Count > 0);
  16. 16: }
  17.  
  18. private bool extractWriteActions(out List<WriteChannel> channelWrites)
  19. {
  20. lock(tpotActionQueue)
  21. {
  22. channelWrites = new List<WriteChannel>();
  23. foreach (TpotAction action in tpotActionQueue)
  24. {
  25. if (action is WriteChannel)
  26. {
  27. channelWrites.Add((WriteChannel)action);
  28.  
  29. action.Status = RecordStatus.Batched;
  30.  
  31. }
  32. }
  33. }
  34. return (channelWrites.Count > 0);
  35. }
  36.  
  37. for (int i=0; i<tpotActionQueue.Count(); i++)
  38. {
  39. TpotAction action = tpotActionQueue.Dequeue();
  40. if (action is WriteChannel)
  41. {
  42. channelWrites.Add((WriteChannel)action);
  43. lock(tpotActionQueue)
  44. {
  45. action.Status = RecordStatus.Batched;
  46. }
  47. }
  48. }
  49.  
  50. for(int i = 0; i < tpotActionQueue.Length; i++)
  51. {
  52. TpotAction action = tpotActionQueue[i];
  53.  
  54. if (action is WriteChannel)
  55. {
  56. channelWrites.Add((WriteChannel)action);
  57. lock(tpotActionQueue)
  58. {
  59. action.Status = RecordStatus.Batched;
  60. }
  61. }
  62. }
  63.  
  64. private bool extractWriteActions(out List<WriteChannel> channelWrites)
  65. {
  66.  
  67. channelWrites= tpotActionQueue.Where<WriteChannel>(x => x is WriteChannel).ToList()
  68.  
  69. foreach(WriteChannel channel in channelWrites) {
  70. channel.Status = RecordStatus.Batched;
  71. }
  72.  
  73. return ( channelWrites.Count > 0);
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement