Sleep.c 724 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. long sleeping = 3000000;
  7. if (argc > 1) {
  8. const char* c = argv[1];
  9. sleeping = 0;
  10. while (*c) {
  11. if ((*c) > '9' || (*c) < '0')
  12. break;
  13. sleeping *= 10;
  14. sleeping += (*c) - '0';
  15. c++;
  16. }
  17. }
  18. pal_printf("Enter Main Thread\n");
  19. if (sleeping) {
  20. pal_printf("Sleeping %ld microsecond...\n", sleeping);
  21. DkThreadDelayExecution(sleeping);
  22. } else {
  23. while (1)
  24. ;
  25. }
  26. pal_printf("Leave Main Thread\n");
  27. return 0;
  28. }