1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

Bind Semaphore.try_wait()

This commit is contained in:
Haoyu Qiu
2022-04-25 13:13:55 +08:00
parent 795fcc4081
commit 8f0f98ffab
3 changed files with 16 additions and 2 deletions

View File

@@ -2613,6 +2613,10 @@ Error _Semaphore::wait() {
return OK; // Can't fail anymore; keep compat
}
Error _Semaphore::try_wait() {
return semaphore.try_wait() ? OK : ERR_BUSY;
}
Error _Semaphore::post() {
semaphore.post();
return OK; // Can't fail anymore; keep compat
@@ -2621,6 +2625,7 @@ Error _Semaphore::post() {
void _Semaphore::_bind_methods() {
ClassDB::bind_method(D_METHOD("wait"), &_Semaphore::wait);
ClassDB::bind_method(D_METHOD("post"), &_Semaphore::post);
ClassDB::bind_method(D_METHOD("try_wait"), &_Semaphore::try_wait);
}
///////////////