summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorNicolas Noble <pixel@nobis-crew.org>2013-08-05 11:53:57 -0700
committerNicolas Noble <pixel@nobis-crew.org>2013-08-05 11:53:57 -0700
commitcd5da6097812baf125c2dc4f1d12e1a3f4985464 (patch)
treeff16f50f3bdd9dad22ec6a1020b1c577a7969ad0 /includes
parent911858d8d7cab0108f1c14abd676ad37ccb9c95a (diff)
Greatly simplifying the LuaYield mechanism so to avoid double-recursive calls in resume().
Diffstat (limited to 'includes')
-rw-r--r--includes/BLua.h6
-rw-r--r--includes/Task.h3
2 files changed, 3 insertions, 6 deletions
diff --git a/includes/BLua.h b/includes/BLua.h
index a464a77..ccf7bee 100644
--- a/includes/BLua.h
+++ b/includes/BLua.h
@@ -162,7 +162,7 @@ class Lua {
void dumpvars(IO<Handle> out, const String & prefix, int idx = -1);
Lua thread(bool saveit = true);
int yield(int nresults = 0) { return lua_yield(L, nresults); }
- int yield(Future<int>) throw (GeneralException) __attribute__((noreturn));
+ int yield(Future<int>) throw (GeneralException);
bool yielded() { return lua_status(L) == LUA_YIELD; }
bool resume(int nargs = 0) throw (GeneralException);
void showstack(int level = M_INFO);
@@ -195,8 +195,8 @@ class Lua {
private:
void dumpvars_i(IO<Handle> out, const String & prefix, int idx);
void dumpvars_r(IO<Handle> out, int idx, int depth = 0) throw (GeneralException);
- bool resumeC();
- bool yieldC() throw (GeneralException);
+ bool resumeC(int & nargs);
+ void yieldC() throw (GeneralException);
void processException(GeneralException & e);
lua_State * L;
diff --git a/includes/Task.h b/includes/Task.h
index 940afe3..a8702b4 100644
--- a/includes/Task.h
+++ b/includes/Task.h
@@ -287,7 +287,6 @@ class Future {
friend class Lua;
func_t m_func;
Events::BaseEvent * m_evt = NULL;
- bool m_ranOnce = false;
};
template<class R>
@@ -298,7 +297,6 @@ R Future<R>::get() {
Task::operationYield(m_evt, Task::INTERRUPTIBLE);
m_evt = NULL;
try {
- m_ranOnce = true;
r = m_func();
return r;
}
@@ -316,7 +314,6 @@ void Future<R>::run() {
Task::operationYield(m_evt, Task::INTERRUPTIBLE);
m_evt = NULL;
try {
- m_ranOnce = true;
m_func();
return;
}