+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.
+
2001-02-28 Ovidiu Predescu <ovidiu@cup.hp.com>
* objc-features.texi: Document the @compatibility_alias compiler
void * objc_thread_get_data(void);
int objc_thread_set_data(void *value);
objc_thread_t objc_thread_id(void);
+void objc_thread_add(void);
+void objc_thread_remove(void);
/*
Use this to set the hook function that will be called when the
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 */