summaryrefslogtreecommitdiff
path: root/core/io/ip.cpp
diff options
context:
space:
mode:
authorYuri Sizov <11782833+YuriSizov@users.noreply.github.com>2023-03-27 20:14:47 +0200
committerGitHub <noreply@github.com>2023-03-27 20:14:47 +0200
commit19501f8eb19481b029f67ecf78e711d42f2fc431 (patch)
tree933ea3320b35bce6ba65ab1e1d1aa8ad662c90d4 /core/io/ip.cpp
parentcacf49999e3fb37281d66cc591ca8bebc5712d4d (diff)
parent843f5adbc523ad2511322b4f09b5ce5a3fb9e225 (diff)
Merge pull request #75397 from YuriSizov/4.0-cherrypicks
Cherry-picks for the 4.0 branch (future 4.0.2) - 1st batch
Diffstat (limited to 'core/io/ip.cpp')
-rw-r--r--core/io/ip.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/io/ip.cpp b/core/io/ip.cpp
index 28b7037120..65728f34f6 100644
--- a/core/io/ip.cpp
+++ b/core/io/ip.cpp
@@ -75,7 +75,7 @@ struct _IP_ResolverPrivate {
Semaphore sem;
Thread thread;
- bool thread_abort = false;
+ SafeFlag thread_abort;
void resolve_queues() {
for (int i = 0; i < IP::RESOLVER_MAX_QUERIES; i++) {
@@ -111,7 +111,7 @@ struct _IP_ResolverPrivate {
static void _thread_function(void *self) {
_IP_ResolverPrivate *ipr = static_cast<_IP_ResolverPrivate *>(self);
- while (!ipr->thread_abort) {
+ while (!ipr->thread_abort.is_set()) {
ipr->sem.wait();
ipr->resolve_queues();
}
@@ -343,12 +343,12 @@ IP::IP() {
singleton = this;
resolver = memnew(_IP_ResolverPrivate);
- resolver->thread_abort = false;
+ resolver->thread_abort.clear();
resolver->thread.start(_IP_ResolverPrivate::_thread_function, resolver);
}
IP::~IP() {
- resolver->thread_abort = true;
+ resolver->thread_abort.set();
resolver->sem.post();
resolver->thread.wait_to_finish();