+/* ********************************************************************************* */
+/* simgrid.process API */
+/* ********************************************************************************* */
+
+/**
+ * \brief Makes the current process sleep for a while.
+ * \param L a Lua state
+ * \return number of values returned to Lua
+ *
+ * - Argument 1 (number): duration of the sleep
+ * - Return value (nil or string): nil in everything went ok, or a string error
+ * if case of failure ("host failure")
+ */
+static int l_process_sleep(lua_State* L)
+{
+ double duration = luaL_checknumber(L, 1);
+ MSG_error_t res = MSG_process_sleep(duration);
+
+ switch (res) {
+
+ case MSG_OK:
+ return 0;
+
+ case MSG_HOST_FAILURE:
+ lua_pushliteral(L, "host failure");
+ return 1;
+
+ default:
+ xbt_die("Unexpected result of MSG_process_sleep: %d, please report this bug", res);
+ }
+}
+
+static const luaL_reg process_functions[] = {
+ {"sleep", l_process_sleep},
+ /* TODO: self, create, kill, suspend, is_suspended, resume, get_name,
+ * get_pid, get_ppid, migrate
+ */
+ {NULL, NULL}
+};
+