Remove NO_THREADS fallback code, Godot 4 requires thread support

This also removes `OS::can_use_threads` from the public API since it's always
true.
This commit is contained in:
Rémi Verschelde
2022-10-03 10:57:36 +02:00
parent d331b803b8
commit 54418ea659
29 changed files with 13 additions and 561 deletions

View File

@ -79,10 +79,8 @@ RemoteDebuggerPeerTCP::RemoteDebuggerPeerTCP(Ref<StreamPeerTCP> p_tcp) {
tcp_client = p_tcp;
if (tcp_client.is_valid()) { // Attaching to an already connected stream.
connected = true;
#ifndef NO_THREADS
running = true;
thread.start(_thread_func, this);
#endif
} else {
tcp_client.instantiate();
}
@ -183,10 +181,8 @@ Error RemoteDebuggerPeerTCP::connect_to_host(const String &p_host, uint16_t p_po
return FAILED;
}
connected = true;
#ifndef NO_THREADS
running = true;
thread.start(_thread_func, this);
#endif
return OK;
}
@ -208,9 +204,7 @@ void RemoteDebuggerPeerTCP::_thread_func(void *p_ud) {
}
void RemoteDebuggerPeerTCP::poll() {
#ifdef NO_THREADS
_poll();
#endif
// Nothing to do, polling is done in thread.
}
void RemoteDebuggerPeerTCP::_poll() {

View File

@ -43,12 +43,12 @@ protected:
public:
virtual bool is_peer_connected() = 0;
virtual int get_max_message_size() const = 0;
virtual bool has_message() = 0;
virtual Error put_message(const Array &p_arr) = 0;
virtual Array get_message() = 0;
virtual void close() = 0;
virtual void poll() = 0;
virtual int get_max_message_size() const = 0;
virtual bool can_block() const { return true; } // If blocking io is allowed on main thread (debug).
RemoteDebuggerPeer();
@ -81,12 +81,12 @@ public:
Error connect_to_host(const String &p_host, uint16_t p_port);
void poll() override;
bool is_peer_connected() override;
bool has_message() override;
Array get_message() override;
Error put_message(const Array &p_arr) override;
int get_max_message_size() const override;
bool has_message() override;
Error put_message(const Array &p_arr) override;
Array get_message() override;
void poll() override;
void close() override;
RemoteDebuggerPeerTCP(Ref<StreamPeerTCP> p_stream = Ref<StreamPeerTCP>());