Sleep.c 710 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* This Hello World simply print out "Hello World" */
  2. #include "pal.h"
  3. #include "pal_debug.h"
  4. char str[13];
  5. int main (int argc, char ** argv, char ** envp)
  6. {
  7. long sleeping = 3000000;
  8. if (argc > 1) {
  9. const char * c = argv[1];
  10. sleeping = 0;
  11. while (*c) {
  12. if ((*c) > '9' || (*c) < '0')
  13. break;
  14. sleeping *= 10;
  15. sleeping += (*c) - '0';
  16. c++;
  17. }
  18. }
  19. pal_printf("Enter Main Thread\n");
  20. if (sleeping) {
  21. pal_printf("Sleeping %ld microsecond...\n", sleeping);
  22. DkThreadDelayExecution(sleeping);
  23. } else {
  24. while (1);
  25. }
  26. pal_printf("Leave Main Thread\n");
  27. return 0;
  28. }