summaryrefslogtreecommitdiff
path: root/src/threads.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2010-12-20 22:23:24 +0200
committerPerttu Ahola <celeron55@gmail.com>2010-12-20 22:23:24 +0200
commitd5a78c12530df800f8182f7012cd16237a7ebafe (patch)
treea942fce4390a2ac3807b0944b384fbed568541ce /src/threads.h
parent123e8fdf53ffb40c7464d0559a49e048fed79d7d (diff)
downloadminetest-d5a78c12530df800f8182f7012cd16237a7ebafe.tar.gz
minetest-d5a78c12530df800f8182f7012cd16237a7ebafe.tar.bz2
minetest-d5a78c12530df800f8182f7012cd16237a7ebafe.zip
added some missing files
Diffstat (limited to 'src/threads.h')
-rw-r--r--src/threads.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/threads.h b/src/threads.h
new file mode 100644
index 000000000..1ea7d0a94
--- /dev/null
+++ b/src/threads.h
@@ -0,0 +1,45 @@
+/*
+Minetest-c55
+Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#ifndef THREADS_HEADER
+#define THREADS_HEADER
+
+#include <jmutex.h>
+
+#if (defined(WIN32) || defined(_WIN32_WCE))
+typedef DWORD threadid_t;
+#define __NORETURN __declspec(noreturn)
+#define __FUNCTION_NAME __FUNCTION__
+#else
+typedef pthread_t threadid_t;
+#define __NORETURN __attribute__ ((__noreturn__))
+#define __FUNCTION_NAME __PRETTY_FUNCTION__
+#endif
+
+inline threadid_t get_current_thread_id()
+{
+#if (defined(WIN32) || defined(_WIN32_WCE))
+ return GetCurrentThreadId();
+#else
+ return pthread_self();
+#endif
+}
+
+#endif
+