From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/gcc~13/synchronization.html | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 devdocs/gcc~13/synchronization.html (limited to 'devdocs/gcc~13/synchronization.html') diff --git a/devdocs/gcc~13/synchronization.html b/devdocs/gcc~13/synchronization.html new file mode 100644 index 00000000..750d7215 --- /dev/null +++ b/devdocs/gcc~13/synchronization.html @@ -0,0 +1,9 @@ +

8.8 Synchronization

GNU Objective-C provides support for synchronized blocks:

@synchronized (ObjCClass *guard) {
+  …
+}
+

Upon entering the @synchronized block, a thread of execution shall first check whether a lock has been placed on the corresponding guard object by another thread. If it has, the current thread shall wait until the other thread relinquishes its lock. Once guard becomes available, the current thread will place its own lock on it, execute the code contained in the @synchronized block, and finally relinquish the lock (thereby making guard available to other threads).

Unlike Java, Objective-C does not allow for entire methods to be marked @synchronized. Note that throwing exceptions out of @synchronized blocks is allowed, and will cause the guarding object to be unlocked properly.

Because of the interactions between synchronization and exception handling, you can only use @synchronized when compiling with exceptions enabled, that is with the command line option -fobjc-exceptions.

+

+ © Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
+ https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Synchronization.html +

+
-- cgit v1.2.3