Move the sleep function to jerry-port (#2245)

Now the jerry-debugger uses the jerry-port's sleep, therefore if there are systems that don't support
usleep or nanosleep can now define their own function.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
This commit is contained in:
imiklos
2018-03-22 02:36:40 +01:00
committed by yichoi
parent d701a7bfb1
commit 15f6ca9f70
4 changed files with 85 additions and 15 deletions
+1 -15
View File
@@ -24,12 +24,6 @@
#ifdef JERRY_DEBUGGER
#ifdef HAVE_TIME_H
#include <time.h>
#elif defined (HAVE_UNISTD_H)
#include <unistd.h>
#endif /* HAVE_TIME_H */
/**
* The number of message types in the debugger should reflect the
* debugger versioning.
@@ -220,15 +214,7 @@ jerry_debugger_send_eval (const lit_utf8_byte_t *eval_string_p, /**< evaluated s
void
jerry_debugger_sleep (void)
{
#ifdef HAVE_TIME_H
nanosleep (&(const struct timespec)
{
JERRY_DEBUGGER_TIMEOUT / 1000, (JERRY_DEBUGGER_TIMEOUT % 1000) * 1000000L /* Seconds, nanoseconds */
}
, NULL);
#elif defined (HAVE_UNISTD_H)
usleep ((useconds_t) JERRY_DEBUGGER_TIMEOUT * 1000);
#endif /* HAVE_TIME_H */
jerry_port_sleep (JERRY_DEBUGGER_TIMEOUT);
} /* jerry_debugger_sleep */
/**