From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libstdc++-v3/doc/html/manual/bk01pt03ch28s03.html | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch28s03.html (limited to 'libstdc++-v3/doc/html/manual/bk01pt03ch28s03.html') diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch28s03.html b/libstdc++-v3/doc/html/manual/bk01pt03ch28s03.html new file mode 100644 index 000000000..b70d5a621 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch28s03.html @@ -0,0 +1,36 @@ + + +Use

Typical usage of the last two constructs is demonstrated as follows: +

+#include <ext/concurrence.h>
+
+namespace
+{
+  __gnu_cxx::__mutex safe_base_mutex;
+} // anonymous namespace
+
+namespace other
+{
+  void
+  foo()
+  {
+    __gnu_cxx::__scoped_lock sentry(safe_base_mutex);
+    for (int i = 0; i < max;  ++i)
+      {
+	_Safe_iterator_base* __old = __iter;
+	__iter = __iter-<_M_next;
+	__old-<_M_detach_single();
+      }
+}
+

In this sample code, an anonymous namespace is used to keep +the __mutex private to the compilation unit, +and __scoped_lock is used to guard access to the critical +section within the for loop, locking the mutex on creation and freeing +the mutex as control moves out of this block. +

Several exception classes are used to keep track of +concurrence-related errors. These classes +are: __concurrence_lock_error, __concurrence_unlock_error, __concurrence_wait_error, +and __concurrence_broadcast_error. +

-- cgit v1.2.3