implement usleep and sleep system calls as no operation which returns control to...
[c11tester.git] / sleeps.cc
diff --git a/sleeps.cc b/sleeps.cc
new file mode 100644 (file)
index 0000000..0528374
--- /dev/null
+++ b/sleeps.cc
@@ -0,0 +1,26 @@
+#include <time.h>
+#include <unistd.h>
+
+#include "action.h"
+#include "model.h"
+
+unsigned int __sleep (unsigned int seconds)
+{
+       model->switch_to_master(
+               new ModelAction(NOOP, std::memory_order_seq_cst, NULL)
+       );
+       return 0;
+}
+
+unsigned int sleep(unsigned int seconds)
+{
+       return __sleep(seconds);
+}
+
+int usleep (useconds_t useconds)
+{
+       model->switch_to_master(
+               new ModelAction(NOOP, std::memory_order_seq_cst, NULL)
+       );
+       return 0;
+}