summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-12-21 09:07:06 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-12-21 09:07:06 -0300
commit15429d6ac95acb044c9eebd64356f33e7e5d14ef (patch)
tree872a375b64d93fd6aaf1239e058a13630c9cfabe /core
parent81f62fb78c7f3c133ef764a99dcdf05077d8ced9 (diff)
parentb2f670ebaefa16b0345f9a7ae825f78dbfdec9f8 (diff)
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp20
-rw-r--r--core/bind/core_bind.h2
-rw-r--r--core/os/input.h2
-rw-r--r--core/os/thread.cpp5
-rw-r--r--core/os/thread.h4
5 files changed, 31 insertions, 2 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 30c90bd71c..438db5d518 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -1883,6 +1883,14 @@ void _Thread::_start_func(void *ud) {
Variant::CallError ce;
const Variant* arg[1]={&t->userdata};
+ // we don't know our thread pointer yet :(
+ if (t->name == "") {
+ // come up with a better name using maybe the filename on the Script?
+ //t->thread->set_name(t->target_method);
+ } else {
+ //t->thread->set_name(t->name);
+ };
+
t->ret=t->target_instance->call(t->target_method,arg,1,ce);
if (ce.error!=Variant::CallError::CALL_OK) {
@@ -1972,12 +1980,24 @@ Variant _Thread::wait_to_finish() {
return r;
}
+Error _Thread::set_name(const String &p_name) {
+
+ name = p_name;
+
+ if (thread) {
+ return thread->set_name(p_name);
+ };
+
+ return OK;
+};
+
void _Thread::_bind_methods() {
ObjectTypeDB::bind_method(_MD("start:Error","instance","method","userdata","priority"),&_Thread::start,DEFVAL(Variant()),DEFVAL(PRIORITY_NORMAL));
ObjectTypeDB::bind_method(_MD("get_id"),&_Thread::get_id);
ObjectTypeDB::bind_method(_MD("is_active"),&_Thread::is_active);
ObjectTypeDB::bind_method(_MD("wait_to_finish:Variant"),&_Thread::wait_to_finish);
+ ObjectTypeDB::bind_method(_MD("set_name:Error", "name"),&_Thread::set_name);
BIND_CONSTANT( PRIORITY_LOW );
BIND_CONSTANT( PRIORITY_NORMAL );
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 24ea810767..172f33dac5 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -508,6 +508,7 @@ protected:
Object *target_instance;
StringName target_method;
Thread *thread;
+ String name;
static void _bind_methods();
static void _start_func(void *ud);
public:
@@ -523,6 +524,7 @@ public:
String get_id() const;
bool is_active() const;
Variant wait_to_finish();
+ Error set_name(const String& p_name);
_Thread();
~_Thread();
diff --git a/core/os/input.h b/core/os/input.h
index 8aa0e6b18a..d81ebf4ec3 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -62,7 +62,7 @@ public:
virtual float get_joy_axis(int p_device,int p_axis)=0;
virtual String get_joy_name(int p_idx)=0;
- virtual void joy_connection_changed(int p_idx, bool p_connected, String p_name)=0;
+ virtual void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid)=0;
virtual Point2 get_mouse_pos() const=0;
diff --git a/core/os/thread.cpp b/core/os/thread.cpp
index 96b0f561ca..53db62c176 100644
--- a/core/os/thread.cpp
+++ b/core/os/thread.cpp
@@ -58,6 +58,11 @@ void Thread::wait_to_finish(Thread *p_thread) {
}
+Error Thread::set_name(const String &p_name) {
+
+ return ERR_UNAVAILABLE;
+};
+
Thread::Thread()
{
}
diff --git a/core/os/thread.h b/core/os/thread.h
index 590fee1fc6..e3d00b0397 100644
--- a/core/os/thread.h
+++ b/core/os/thread.h
@@ -35,6 +35,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
+#include "ustring.h"
typedef void (*ThreadCreateCallback)(void *p_userdata);
@@ -71,7 +72,8 @@ protected:
Thread();
public:
-
+
+ virtual Error set_name(const String& p_name);
virtual ID get_ID() const=0;