summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-08-05 07:04:50 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-08-05 07:04:50 +0200
commitf0864213a4175cc77cc84abe56831f294a9c7d25 (patch)
treed3439c93465def7293e3faa46a45e0a75b1003ca /src
parentd5d0184206ebebaa53720b3af5a6d14d23aafaa1 (diff)
Let's be a bit more explicit about the effects of not catching EAgain.
Diffstat (limited to 'src')
-rw-r--r--src/BLua.cc5
-rw-r--r--src/Task.cc4
2 files changed, 8 insertions, 1 deletions
diff --git a/src/BLua.cc b/src/BLua.cc
index 2bc726e..e729d83 100644
--- a/src/BLua.cc
+++ b/src/BLua.cc
@@ -253,7 +253,10 @@ int Balau::LuaStatics::callwrap(lua_State * __L, lua_CFunction func) {
L.push((void *) &s_signature);
r = L.yield(L.gettop());
}
- catch (Balau::GeneralException & e) {
+ catch (EAgain & e) {
+ L.error("The C callback from Lua has thrown an EAgain - you can't do that, you have to wrap it using Lua::yield. The application will now crash, because this task will stop, but the event in the EAgain will later try to wake it up.");
+ }
+ catch (GeneralException & e) {
L.error(String("GeneralException: ") + e.getMsg());
}
// LuaJIT sucks sometime.
diff --git a/src/Task.cc b/src/Task.cc
index eb6cc7f..a4ec5bc 100644
--- a/src/Task.cc
+++ b/src/Task.cc
@@ -101,6 +101,10 @@ void Balau::Task::coroutine() {
Printer::elog(E_TASK, "Stackless task %s at %p is task-switching.", getName(), this);
}
}
+ catch (EAgain & e) {
+ Printer::log(M_ERROR, "Task %s at %p threw an EAgain - you should catch it and yield; the app will crash now", getName(), this);
+ m_status = FAULTED;
+ }
catch (GeneralException & e) {
Printer::log(M_WARNING, "Task %s at %p caused an exception: `%s' - stopping.", getName(), this, e.getMsg());
const char * details = e.getDetails();