diff options
author | shebs <shebs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-03-15 02:18:09 +0000 |
---|---|---|
committer | shebs <shebs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-03-15 02:18:09 +0000 |
commit | ad5a392a1bda8db116d15f3ee09d282d956141a9 (patch) | |
tree | 6f6458a683b563d93474ff1881bc95959806736a /libobjc | |
parent | 3239b2ba5f5aa18b9bf5573327614856d4bb0bc0 (diff) | |
download | gcc-ad5a392a1bda8db116d15f3ee09d282d956141a9.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40479 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc')
-rw-r--r-- | libobjc/ChangeLog | 7 | ||||
-rw-r--r-- | libobjc/libobjc.def | 2 | ||||
-rw-r--r-- | libobjc/objc/thr.h | 2 | ||||
-rw-r--r-- | libobjc/thr.c | 29 |
4 files changed, 40 insertions, 0 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index da822e57a7b..c53b3a5b913 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,10 @@ +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 diff --git a/libobjc/libobjc.def b/libobjc/libobjc.def index a4a6049e816..7e0a857ecf7 100644 --- a/libobjc/libobjc.def +++ b/libobjc/libobjc.def @@ -45,6 +45,8 @@ objc_thread_id objc_thread_set_data objc_thread_set_priority objc_thread_yield +objc_thread_add +objc_thread_remove __objc_class_name_Object __objc_class_name_Protocol __objc_class_name_NXConstantString diff --git a/libobjc/objc/thr.h b/libobjc/objc/thr.h index f904733695a..59766f6ed7d 100644 --- a/libobjc/objc/thr.h +++ b/libobjc/objc/thr.h @@ -96,6 +96,8 @@ int objc_thread_get_priority(void); 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 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 */ |