Update the webpage (#2289)

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó
2018-04-19 14:31:04 +02:00
committed by Zoltan Herczeg
parent 41fa2aa172
commit dc12458382
6 changed files with 577 additions and 218 deletions
+38
View File
@@ -122,6 +122,15 @@ Allow user to provide external buffer for jerry instance (which includes an isol
struct jerry_instance_t *jerry_port_get_current_instance (void);
```
## Sleep
```c
/**
* Makes the process sleep for a given time.
*/
void jerry_port_sleep (uint32_t sleep_time);
```
# How to port JerryScript
This section describes a basic port implementation which was created for Unix based systems.
@@ -241,3 +250,32 @@ jerry_port_get_current_instance (void)
return current_instance_p;
} /* jerry_port_get_current_instance */
```
## Sleep
```c
#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
#ifdef HAVE_TIME_H
#include <time.h>
#elif defined (HAVE_UNISTD_H)
#include <unistd.h>
#endif /* HAVE_TIME_H */
#ifdef JERRY_DEBUGGER
void jerry_port_sleep (uint32_t sleep_time)
{
#ifdef HAVE_TIME_H
nanosleep (&(const struct timespec)
{
sleep_time / 1000, (sleep_time % 1000) * 1000000L /* Seconds, nanoseconds */
}
, NULL);
#elif defined (HAVE_UNISTD_H)
usleep ((useconds_t) sleep_time * 1000);
#endif /* HAVE_TIME_H */
(void) sleep_time;
} /* jerry_port_sleep */
#endif /* JERRY_DEBUGGER */
```