aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-07-06 13:54:01 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-07-06 13:54:01 -0300
commitd39ea8b3ce684728c1ad5005192766d39d2e8baa (patch)
treea6366af9c0fb14af5b244b609cbc3da2b652b798 /testes
parent6298903e35217ab69c279056f925fb72900ce0b7 (diff)
downloadlua-d39ea8b3ce684728c1ad5005192766d39d2e8baa.tar.gz
lua-d39ea8b3ce684728c1ad5005192766d39d2e8baa.tar.bz2
lua-d39ea8b3ce684728c1ad5005192766d39d2e8baa.zip
Make sure that main thread is non yieldable
Main thread must be non yieldable even at "level 0" (bare API), outside the 'pcall' from 'lua.c'.
Diffstat (limited to 'testes')
-rw-r--r--testes/coroutine.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/testes/coroutine.lua b/testes/coroutine.lua
index 0a4c2ef3..955f6776 100644
--- a/testes/coroutine.lua
+++ b/testes/coroutine.lua
@@ -407,7 +407,8 @@ assert(_G.f() == 12)
407 407
408 408
409if not T then 409if not T then
410 (Message or print)('\n >>> testC not active: skipping yield/hook tests <<<\n') 410 (Message or print)
411 ('\n >>> testC not active: skipping coroutine API tests <<<\n')
411else 412else
412 print "testing yields inside hooks" 413 print "testing yields inside hooks"
413 414
@@ -564,8 +565,17 @@ else
564 c == "ERRRUN" and d == 4) 565 c == "ERRRUN" and d == 4)
565 566
566 567
567 -- using a main thread as a coroutine 568 -- using a main thread as a coroutine (dubious use!)
568 local state = T.newstate() 569 local state = T.newstate()
570
571 -- check that yielddable is working correctly
572 assert(T.testC(state, "newthread; isyieldable -1; remove 1; return 1"))
573
574 -- main thread is not yieldable
575 assert(not T.testC(state, "rawgeti R 1; isyieldable -1; remove 1; return 1"))
576
577 T.testC(state, "settop 0")
578
569 T.loadlib(state) 579 T.loadlib(state)
570 580
571 assert(T.doremote(state, [[ 581 assert(T.doremote(state, [[