summaryrefslogtreecommitdiff
path: root/libobjc/thr.c
diff options
context:
space:
mode:
authorNicola Pero <n.pero@mi.flashnet.it>2001-03-15 03:18:09 +0100
committerStan Shebs <shebs@gcc.gnu.org>2001-03-15 02:18:09 +0000
commitb894530e6d9633fc6497b3c404a3ec1bd1a341df (patch)
tree6f6458a683b563d93474ff1881bc95959806736a /libobjc/thr.c
parent84c041a1ffd28bd3e380d49f8ece24ade3c8baf2 (diff)
downloadgcc-b894530e6d9633fc6497b3c404a3ec1bd1a341df.tar.gz
thr.c (objc_thread_add): New function.
2001-03-14 Nicola Pero <n.pero@mi.flashnet.it> * thr.c (objc_thread_add): New function. (objc_thread_remove): Ditto. * objc/thr.h: Declare them. * libobjc.def: Mention them. From-SVN: r40479
Diffstat (limited to 'libobjc/thr.c')
-rw-r--r--libobjc/thr.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libobjc/thr.c b/libobjc/thr.c
index f1c957aaa15..437ee577810 100644
--- a/libobjc/thr.c
+++ b/libobjc/thr.c
@@ -531,4 +531,33 @@ objc_condition_signal(objc_condition_t condition)
return __objc_condition_signal(condition);
}
+/* Make the objc thread system aware that a thread which is managed
+ (started, stopped) by external code could access objc facilities
+ from now on. This is used when you are interfacing with some
+ external non-objc-based environment/system - you must call
+ objc_thread_add() before an alien thread makes any calls to
+ Objective-C. Do not cause the _objc_became_multi_threaded hook to
+ be executed. */
+void
+objc_thread_add(void)
+{
+ objc_mutex_lock(__objc_runtime_mutex);
+ __objc_is_multi_threaded = 1;
+ __objc_runtime_threads_alive++;
+ objc_mutex_unlock(__objc_runtime_mutex);
+}
+
+/* Make the objc thread system aware that a thread managed (started,
+ stopped) by some external code will no longer access objc and thus
+ can be forgotten by the objc thread system. Call
+ objc_thread_remove() when your alien thread is done with making
+ calls to Objective-C. */
+void
+objc_thread_remove(void)
+{
+ objc_mutex_lock(__objc_runtime_mutex);
+ __objc_runtime_threads_alive--;
+ objc_mutex_unlock(__objc_runtime_mutex);
+}
+
/* End of File */