/platform/osx/thread.d

http://github.com/wilkie/djehuty · D · 88 lines · 66 code · 21 blank · 1 comment · 4 complexity · 208d0483bc651d5f9149ad068a27495b MD5 · raw file

  1. module platform.osx.thread;
  2. class Thread
  3. {
  4. public:
  5. ~this()
  6. {
  7. Stop();
  8. }
  9. // the common function for the thread
  10. void Call()
  11. {
  12. if (_thread_callback !is null)
  13. {
  14. _thread_callback();
  15. }
  16. else if (_thread_f_callback !is null)
  17. {
  18. _thread_f_callback();
  19. }
  20. }
  21. void SetDelegate(void delegate() callback)
  22. {
  23. _thread_callback = callback;
  24. _thread_f_callback = null;
  25. }
  26. void SetDelegate(void function() callback)
  27. {
  28. _thread_f_callback = callback;
  29. _thread_callback = null;
  30. }
  31. bool IsCurrentThread()
  32. {
  33. }
  34. void Sleep(long milliseconds)
  35. {
  36. }
  37. void Start()
  38. {
  39. }
  40. void Stop()
  41. {
  42. }
  43. protected:
  44. void delegate () _thread_callback = null;
  45. void function () _thread_f_callback = null;
  46. }
  47. class Semaphore
  48. {
  49. public:
  50. ~this()
  51. {
  52. if (_inited)
  53. {
  54. CloseHandle(_semaphore);
  55. }
  56. }
  57. void Init(uint initialValue)
  58. {
  59. }
  60. void Up()
  61. {
  62. }
  63. void Down()
  64. {
  65. }
  66. protected:
  67. }