diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-07-04 09:46:53 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-07-04 09:46:53 +0200 |
| commit | f3b7facea8de585dda1d4f5bd1d9716b40b1ce94 (patch) | |
| tree | 7e563c383f381ef27872ae8bead86165c26a3cc7 | |
| parent | f37a7c2334fdfb8f30d0b76ecf25aff484adec28 (diff) | |
| download | lanes-f3b7facea8de585dda1d4f5bd1d9716b40b1ce94.tar.gz lanes-f3b7facea8de585dda1d4f5bd1d9716b40b1ce94.tar.bz2 lanes-f3b7facea8de585dda1d4f5bd1d9716b40b1ce94.zip | |
get_debug_threadname → get_threadname
| -rw-r--r-- | src/lane.cpp | 8 | ||||
| -rw-r--r-- | src/lanes.cpp | 2 | ||||
| -rw-r--r-- | tests/basic.lua | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/lane.cpp b/src/lane.cpp index e045d88..7182ad6 100644 --- a/src/lane.cpp +++ b/src/lane.cpp | |||
| @@ -44,8 +44,8 @@ static constexpr UniqueKey kCachedTostring{ 0xAB5EA23BCEA0C35Cull }; | |||
| 44 | // ################################################################################################# | 44 | // ################################################################################################# |
| 45 | // ################################################################################################# | 45 | // ################################################################################################# |
| 46 | 46 | ||
| 47 | // lane:get_debug_threadname() | 47 | // lane:get_threadname() |
| 48 | static LUAG_FUNC(get_debug_threadname) | 48 | static LUAG_FUNC(get_threadname) |
| 49 | { | 49 | { |
| 50 | Lane* const _lane{ ToLane(L_, 1) }; | 50 | Lane* const _lane{ ToLane(L_, 1) }; |
| 51 | luaL_argcheck(L_, lua_gettop(L_) == 1, 2, "too many arguments"); | 51 | luaL_argcheck(L_, lua_gettop(L_) == 1, 2, "too many arguments"); |
| @@ -1079,7 +1079,7 @@ namespace { | |||
| 1079 | { "__gc", LG_lane_gc }, | 1079 | { "__gc", LG_lane_gc }, |
| 1080 | { "__index", LG_thread_index }, | 1080 | { "__index", LG_thread_index }, |
| 1081 | { "cancel", LG_thread_cancel }, | 1081 | { "cancel", LG_thread_cancel }, |
| 1082 | { "get_debug_threadname", LG_get_debug_threadname }, | 1082 | { "get_threadname", LG_get_threadname }, |
| 1083 | { "join", LG_thread_join }, | 1083 | { "join", LG_thread_join }, |
| 1084 | { "resume", LG_thread_resume }, | 1084 | { "resume", LG_thread_resume }, |
| 1085 | { nullptr, nullptr } | 1085 | { nullptr, nullptr } |
| @@ -1087,7 +1087,7 @@ namespace { | |||
| 1087 | } // namespace local | 1087 | } // namespace local |
| 1088 | } // namespace | 1088 | } // namespace |
| 1089 | 1089 | ||
| 1090 | // contains keys: { __close, __gc, __index, kCachedError, kCachedTostring, cancel, get_debug_threadname, join } | 1090 | // contains keys: { __close, __gc, __index, kCachedError, kCachedTostring, cancel, get_threadname, join } |
| 1091 | void Lane::PushMetatable(lua_State* L_) | 1091 | void Lane::PushMetatable(lua_State* L_) |
| 1092 | { | 1092 | { |
| 1093 | STACK_CHECK_START_REL(L_, 0); | 1093 | STACK_CHECK_START_REL(L_, 0); |
diff --git a/src/lanes.cpp b/src/lanes.cpp index f1b5884..b096774 100644 --- a/src/lanes.cpp +++ b/src/lanes.cpp | |||
| @@ -723,7 +723,7 @@ LUAG_FUNC(configure) | |||
| 723 | STACK_CHECK(L_, 2); | 723 | STACK_CHECK(L_, 2); |
| 724 | 724 | ||
| 725 | // prepare the metatable for threads | 725 | // prepare the metatable for threads |
| 726 | // contains keys: { __gc, __index, cancel, join, get_debug_threadname } | 726 | // contains keys: { __gc, __index, cancel, join, get_threadname } |
| 727 | Lane::PushMetatable(L_); // L_: settings M {lane_mt} | 727 | Lane::PushMetatable(L_); // L_: settings M {lane_mt} |
| 728 | lua_pushcclosure(L_, LG_lane_new, 1); // L_: settings M lane_new | 728 | lua_pushcclosure(L_, LG_lane_new, 1); // L_: settings M lane_new |
| 729 | lua_setfield(L_, -2, "lane_new"); // L_: settings M | 729 | lua_setfield(L_, -2, "lane_new"); // L_: settings M |
diff --git a/tests/basic.lua b/tests/basic.lua index f44c75f..820d3c8 100644 --- a/tests/basic.lua +++ b/tests/basic.lua | |||
| @@ -501,12 +501,12 @@ end) | |||
| 501 | h= S { 12, 13, 14 } -- execution starts, h[1..3] will get the return values | 501 | h= S { 12, 13, 14 } -- execution starts, h[1..3] will get the return values |
| 502 | -- wait a bit so that the lane has a chance to set its debug name | 502 | -- wait a bit so that the lane has a chance to set its debug name |
| 503 | SLEEP(0.5) | 503 | SLEEP(0.5) |
| 504 | print("joining with '" .. h:get_debug_threadname() .. "'") | 504 | print("joining with '" .. h:get_threadname() .. "'") |
| 505 | local a,b,c,d= h:join() | 505 | local a,b,c,d= h:join() |
| 506 | if h.status == "error" then | 506 | if h.status == "error" then |
| 507 | print(h:get_debug_threadname(), "error: " , a, b, c, d) | 507 | print(h:get_threadname(), "error: " , a, b, c, d) |
| 508 | else | 508 | else |
| 509 | print(h:get_debug_threadname(), a,b,c,d) | 509 | print(h:get_threadname(), a,b,c,d) |
| 510 | assert(a==14) | 510 | assert(a==14) |
| 511 | assert(b==13) | 511 | assert(b==13) |
| 512 | assert(c==12) | 512 | assert(c==12) |
