Guest User

Untitled

a guest
Nov 23rd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. 2
  2. 3
  3. 4
  4. 5
  5. 6
  6. 7
  7. 8
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. #include "pt.h"
  29.  
  30. static int counter;
  31. static struct pt example_pt;
  32.  
  33. static PT_THREAD(example(struct pt *pt))
  34. {
  35. PT_BEGIN(pt);
  36. printf("This should be executed just once!\n"); //이부분은 테스트목적으로 추가함.
  37. while(1) {
  38. PT_WAIT_UNTIL(pt, counter == 1000);
  39. printf("Threshold reached\n");
  40. counter = 0;
  41. }
  42.  
  43. PT_END(pt);
  44. }
  45.  
  46. int main(void)
  47. {
  48. counter = 0;
  49. PT_INIT(&example_pt);
  50. while(1) { // 직접 스케쥴링을 해줘야한다.
  51. example(&example_pt);
  52. counter++;
  53. }
  54. return 0;
  55. }
Add Comment
Please, Sign In to add comment