Sleep.c 886 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* -*- mode:c; c-file-style:"k&r"; c-basic-offset: 4; tab-width:4; indent-tabs-mode:nil; mode:auto-fill; fill-column:78; -*- */
  2. /* vim: set ts=4 sw=4 et tw=78 fo=cqt wm=0: */
  3. /* This Hello World simply print out "Hello World" */
  4. #include "pal.h"
  5. #include "pal_debug.h"
  6. char str[13];
  7. int main (int argc, char ** argv, char ** envp)
  8. {
  9. long sleeping = 3000000;
  10. if (argc > 1) {
  11. const char * c = argv[1];
  12. sleeping = 0;
  13. while (*c) {
  14. if ((*c) > '9' || (*c) < '0')
  15. break;
  16. sleeping *= 10;
  17. sleeping += (*c) - '0';
  18. c++;
  19. }
  20. }
  21. pal_printf("Enter Main Thread\n");
  22. if (sleeping) {
  23. pal_printf("Sleeping %ld microsecond...\n", sleeping);
  24. DkThreadDelayExecution(sleeping);
  25. } else {
  26. while (1);
  27. }
  28. pal_printf("Leave Main Thread\n");
  29. return 0;
  30. }