ContinousWorker.cs 974 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Threading.Tasks;
  3. using Quadarax.Foundation.Core.Logging;
  4. namespace Quadarax.Foundation.Core.Thread
  5. {
  6. public class ContinousWorker : AbstractWorker
  7. {
  8. #region *** Private fields ***
  9. private Action _body;
  10. #endregion
  11. #region *** Properties ***
  12. #endregion
  13. #region *** Constructors ***
  14. public ContinousWorker(Action body = null) : base()
  15. {
  16. _body = body;
  17. }
  18. public ContinousWorker(string workerName, ILogger logger = null) : base(workerName,null, logger)
  19. {
  20. }
  21. #endregion
  22. #region *** Public Operations ***
  23. #endregion
  24. #region *** Virtuals and protected ***
  25. protected override async Task Do(IWorkerContext context)
  26. {
  27. _body?.Invoke();
  28. }
  29. #endregion
  30. #region *** Private Operations ***
  31. #endregion
  32. }
  33. }