|
@@ -33,6 +33,9 @@
|
|
|
#include <core/debug.h>
|
|
|
#include <core/sched_ctx.h>
|
|
|
#include <time.h>
|
|
|
+#ifdef STARPU_HAVE_WINDOWS
|
|
|
+#include <windows.h>
|
|
|
+#endif
|
|
|
|
|
|
/* XXX this should be reinitialized when StarPU is shutdown (or we should make
|
|
|
* sure that no task remains !) */
|
|
@@ -1011,12 +1014,25 @@ char *_starpu_task_get_cpu_name_nth_implementation(struct starpu_codelet *cl, un
|
|
|
return cl->cpu_funcs_name[nimpl];
|
|
|
}
|
|
|
|
|
|
+void _starpu_sleep(struct timespec ts)
|
|
|
+{
|
|
|
+#ifdef STARPU_HAVE_WINDOWS
|
|
|
+ Sleep((ts.tv_sec * 1000) + (ts.tv_nsec / 1000000));
|
|
|
+#else
|
|
|
+ struct timespec req, rem;
|
|
|
+
|
|
|
+ req = ts;
|
|
|
+ while (nanosleep(&req, &rem))
|
|
|
+ req = rem;
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
static starpu_pthread_t watchdog_thread;
|
|
|
|
|
|
/* Check from times to times that StarPU does finish some tasks */
|
|
|
static void *watchdog_func(void *foo STARPU_ATTRIBUTE_UNUSED)
|
|
|
{
|
|
|
- struct timespec ts, req, rem;
|
|
|
+ struct timespec ts;
|
|
|
char *timeout_env;
|
|
|
unsigned long long timeout;
|
|
|
|
|
@@ -1034,9 +1050,7 @@ static void *watchdog_func(void *foo STARPU_ATTRIBUTE_UNUSED)
|
|
|
watchdog_ok = 0;
|
|
|
STARPU_PTHREAD_MUTEX_UNLOCK(&submitted_mutex);
|
|
|
|
|
|
- req = ts;
|
|
|
- while (nanosleep(&req, &rem))
|
|
|
- req = rem;
|
|
|
+ _starpu_sleep(ts);
|
|
|
|
|
|
STARPU_PTHREAD_MUTEX_LOCK(&submitted_mutex);
|
|
|
if (!watchdog_ok && last_nsubmitted
|