diff options
Diffstat (limited to 'src/lanes.cpp')
-rw-r--r-- | src/lanes.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lanes.cpp b/src/lanes.cpp index e3f53c0..acfa0dc 100644 --- a/src/lanes.cpp +++ b/src/lanes.cpp | |||
@@ -456,7 +456,7 @@ static int selfdestruct_gc( lua_State* L) | |||
456 | while( s != SELFDESTRUCT_END) | 456 | while( s != SELFDESTRUCT_END) |
457 | { | 457 | { |
458 | // attempt a regular unforced hard cancel with a small timeout | 458 | // attempt a regular unforced hard cancel with a small timeout |
459 | bool const cancelled = THREAD_ISNULL( s->thread) || thread_cancel( L, s, CO_Hard, 0.0001, false, 0.0); | 459 | bool const cancelled = THREAD_ISNULL( s->thread) || thread_cancel( L, s, CO_Hard, 0.0001, false, 0.0) != CancelResult::Timeout; |
460 | // if we failed, and we know the thread is waiting on a linda | 460 | // if we failed, and we know the thread is waiting on a linda |
461 | if( cancelled == false && s->status == WAITING && s->waiting_on != nullptr) | 461 | if( cancelled == false && s->status == WAITING && s->waiting_on != nullptr) |
462 | { | 462 | { |
@@ -501,7 +501,7 @@ static int selfdestruct_gc( lua_State* L) | |||
501 | Lane* s = U->selfdestruct_first; | 501 | Lane* s = U->selfdestruct_first; |
502 | while( s != SELFDESTRUCT_END) | 502 | while( s != SELFDESTRUCT_END) |
503 | { | 503 | { |
504 | if( s->cancel_request == CANCEL_HARD) | 504 | if (s->cancel_request == CancelRequest::Hard) |
505 | ++ n; | 505 | ++ n; |
506 | s = s->selfdestruct_next; | 506 | s = s->selfdestruct_next; |
507 | } | 507 | } |
@@ -1239,13 +1239,13 @@ LUAG_FUNC( lane_new) | |||
1239 | s->status = PENDING; | 1239 | s->status = PENDING; |
1240 | s->waiting_on = nullptr; | 1240 | s->waiting_on = nullptr; |
1241 | s->debug_name = "<unnamed>"; | 1241 | s->debug_name = "<unnamed>"; |
1242 | s->cancel_request = CANCEL_NONE; | 1242 | s->cancel_request = CancelRequest::None; |
1243 | 1243 | ||
1244 | #if THREADWAIT_METHOD == THREADWAIT_CONDVAR | 1244 | #if THREADWAIT_METHOD == THREADWAIT_CONDVAR |
1245 | MUTEX_INIT( &s->done_lock); | 1245 | MUTEX_INIT( &s->done_lock); |
1246 | SIGNAL_INIT( &s->done_signal); | 1246 | SIGNAL_INIT( &s->done_signal); |
1247 | #endif // THREADWAIT_METHOD == THREADWAIT_CONDVAR | 1247 | #endif // THREADWAIT_METHOD == THREADWAIT_CONDVAR |
1248 | s->mstatus = NORMAL; | 1248 | s->mstatus = ThreadStatus::Normal; |
1249 | s->selfdestruct_next = nullptr; | 1249 | s->selfdestruct_next = nullptr; |
1250 | #if HAVE_LANE_TRACKING() | 1250 | #if HAVE_LANE_TRACKING() |
1251 | s->tracking_next = nullptr; | 1251 | s->tracking_next = nullptr; |
@@ -1322,8 +1322,8 @@ LUAG_FUNC( thread_gc) | |||
1322 | } | 1322 | } |
1323 | 1323 | ||
1324 | // We can read 's->status' without locks, but not wait for it | 1324 | // We can read 's->status' without locks, but not wait for it |
1325 | // test KILLED state first, as it doesn't need to enter the selfdestruct chain | 1325 | // test Killed state first, as it doesn't need to enter the selfdestruct chain |
1326 | if( s->mstatus == KILLED) | 1326 | if (s->mstatus == ThreadStatus::Killed) |
1327 | { | 1327 | { |
1328 | // Make sure a kill has proceeded, before cleaning up the data structure. | 1328 | // Make sure a kill has proceeded, before cleaning up the data structure. |
1329 | // | 1329 | // |
@@ -1392,7 +1392,7 @@ static char const * thread_status_string( Lane* s) | |||
1392 | { | 1392 | { |
1393 | enum e_status st = s->status; // read just once (volatile) | 1393 | enum e_status st = s->status; // read just once (volatile) |
1394 | char const* str = | 1394 | char const* str = |
1395 | (s->mstatus == KILLED) ? "killed" : // new to v3.3.0! | 1395 | (s->mstatus == ThreadStatus::Killed) ? "killed" : // new to v3.3.0! |
1396 | (st == PENDING) ? "pending" : | 1396 | (st == PENDING) ? "pending" : |
1397 | (st == RUNNING) ? "running" : // like in 'co.status()' | 1397 | (st == RUNNING) ? "running" : // like in 'co.status()' |
1398 | (st == WAITING) ? "waiting" : | 1398 | (st == WAITING) ? "waiting" : |
@@ -1438,7 +1438,7 @@ LUAG_FUNC( thread_join) | |||
1438 | STACK_CHECK( L, 0); | 1438 | STACK_CHECK( L, 0); |
1439 | // Thread is DONE/ERROR_ST/CANCELLED; all ours now | 1439 | // Thread is DONE/ERROR_ST/CANCELLED; all ours now |
1440 | 1440 | ||
1441 | if( s->mstatus == KILLED) // OS thread was killed if thread_cancel was forced | 1441 | if (s->mstatus == ThreadStatus::Killed) // OS thread was killed if thread_cancel was forced |
1442 | { | 1442 | { |
1443 | // in that case, even if the thread was killed while DONE/ERROR_ST/CANCELLED, ignore regular return values | 1443 | // in that case, even if the thread was killed while DONE/ERROR_ST/CANCELLED, ignore regular return values |
1444 | STACK_GROW( L, 2); | 1444 | STACK_GROW( L, 2); |
@@ -1548,7 +1548,7 @@ LUAG_FUNC( thread_index) | |||
1548 | switch( s->status) | 1548 | switch( s->status) |
1549 | { | 1549 | { |
1550 | default: | 1550 | default: |
1551 | if( s->mstatus != KILLED) | 1551 | if (s->mstatus != ThreadStatus::Killed) |
1552 | { | 1552 | { |
1553 | // this is an internal error, we probably never get here | 1553 | // this is an internal error, we probably never get here |
1554 | lua_settop( L, 0); | 1554 | lua_settop( L, 0); |