Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- #include "pt.h"
- static int counter;
- static struct pt example_pt;
- static PT_THREAD(example(struct pt *pt))
- {
- PT_BEGIN(pt);
- printf("This should be executed just once!\n"); //이부분은 테스트목적으로 추가함.
- while(1) {
- PT_WAIT_UNTIL(pt, counter == 1000);
- printf("Threshold reached\n");
- counter = 0;
- }
- PT_END(pt);
- }
- int main(void)
- {
- counter = 0;
- PT_INIT(&example_pt);
- while(1) { // 직접 스케쥴링을 해줘야한다.
- example(&example_pt);
- counter++;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment