From 4e7e61681429e7ea13501cae574f88bf90c5900a Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 27 Nov 2019 00:52:36 +0800 Subject: add scheduler stub --- xmake/core/base/scheduler.lua | 37 ++++++++++++++++++++++ .../sandbox/modules/import/core/base/scheduler.lua | 37 ++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 xmake/core/base/scheduler.lua create mode 100644 xmake/core/sandbox/modules/import/core/base/scheduler.lua diff --git a/xmake/core/base/scheduler.lua b/xmake/core/base/scheduler.lua new file mode 100644 index 000000000..9b2bacf41 --- /dev/null +++ b/xmake/core/base/scheduler.lua @@ -0,0 +1,37 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015 - 2019, TBOOX Open Source Group. +-- +-- @author ruki +-- @file scheduler.lua +-- + +-- define module: scheduler +local scheduler = scheduler or {} + +-- load modules +local utils = require("base/utils") +local option = require("base/option") +local string = require("base/string") +local coroutine = require("base/coroutine") + +-- run loop, schedule coroutine with socket/io and sub-processes +function scheduler:runloop(main) + -- TODO + return coroutine.resume(coroutine.create(main)) +end + +-- return module: scheduler +return scheduler diff --git a/xmake/core/sandbox/modules/import/core/base/scheduler.lua b/xmake/core/sandbox/modules/import/core/base/scheduler.lua new file mode 100644 index 000000000..0b2c98c2d --- /dev/null +++ b/xmake/core/sandbox/modules/import/core/base/scheduler.lua @@ -0,0 +1,37 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015 - 2019, TBOOX Open Source Group. +-- +-- @author ruki +-- @file scheduler.lua +-- + +-- define module +local sandbox_core_base_scheduler = sandbox_core_base_scheduler or {} + +-- load modules +local scheduler = require("base/scheduler") +local raise = require("sandbox/modules/raise") + +-- run loop +function sandbox_core_base_scheduler.runloop(main) + local ok, errors = scheduler:runloop(main) + if not ok then + raise(errors) + end +end + +-- return module +return sandbox_core_base_scheduler -- cgit v1.3.1