Merge pull request #36752 from RandomShaper/rework_semaphore
Drop old semaphore implementation
This commit is contained in:
commit
42595085a5
33 changed files with 79 additions and 803 deletions
|
|
@ -2576,32 +2576,28 @@ void _Marshalls::_bind_methods() {
|
|||
|
||||
////////////////
|
||||
|
||||
Error _Semaphore::wait() {
|
||||
void _Semaphore::wait() {
|
||||
|
||||
return semaphore->wait();
|
||||
semaphore.wait();
|
||||
}
|
||||
|
||||
Error _Semaphore::post() {
|
||||
Error _Semaphore::try_wait() {
|
||||
|
||||
return semaphore->post();
|
||||
return semaphore.try_wait() ? OK : ERR_BUSY;
|
||||
}
|
||||
|
||||
void _Semaphore::post() {
|
||||
|
||||
semaphore.post();
|
||||
}
|
||||
|
||||
void _Semaphore::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("wait"), &_Semaphore::wait);
|
||||
ClassDB::bind_method(D_METHOD("try_wait"), &_Semaphore::try_wait);
|
||||
ClassDB::bind_method(D_METHOD("post"), &_Semaphore::post);
|
||||
}
|
||||
|
||||
_Semaphore::_Semaphore() {
|
||||
|
||||
semaphore = SemaphoreOld::create();
|
||||
}
|
||||
|
||||
_Semaphore::~_Semaphore() {
|
||||
|
||||
memdelete(semaphore);
|
||||
}
|
||||
|
||||
///////////////
|
||||
|
||||
void _Mutex::lock() {
|
||||
|
|
|
|||
|
|
@ -635,16 +635,14 @@ public:
|
|||
class _Semaphore : public Reference {
|
||||
|
||||
GDCLASS(_Semaphore, Reference);
|
||||
SemaphoreOld *semaphore;
|
||||
Semaphore semaphore;
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
Error wait();
|
||||
Error post();
|
||||
|
||||
_Semaphore();
|
||||
~_Semaphore();
|
||||
void wait();
|
||||
Error try_wait();
|
||||
void post();
|
||||
};
|
||||
|
||||
class _Thread : public Reference {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue