[cfe-commits] [libcxxabi] r148965 - /libcxxabi/trunk/src/cxa_guard.cpp

Howard Hinnant hhinnant at apple.com
Wed Jan 25 11:02:40 PST 2012


Author: hhinnant
Date: Wed Jan 25 13:02:40 2012
New Revision: 148965

URL: http://llvm.org/viewvc/llvm-project?rev=148965&view=rev
Log:
cxa_guard.cpp didn't quite make it on the last commit:  Restricted headers to cxa_guard.cpp and abort_messsage.h, and added a comment regarding reentrancy brought up by John McCall.  Thanks John.

Modified:
    libcxxabi/trunk/src/cxa_guard.cpp

Modified: libcxxabi/trunk/src/cxa_guard.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_guard.cpp?rev=148965&r1=148964&r2=148965&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_guard.cpp (original)
+++ libcxxabi/trunk/src/cxa_guard.cpp Wed Jan 25 13:02:40 2012
@@ -7,13 +7,20 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "cxxabi.h"
 #include "abort_message.h"
 
 #include <pthread.h>
 #include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
+
+/*
+    This implementation must be careful to not call code external to this file
+    which will turn around and try to call __cxa_guard_acquire reentrantly.
+    For this reason, the headers of this file are as restricted as possible.
+    Previous implementations of this code for __APPLE__ have used
+    pthread_mutex_lock and the abort_message utility without problem.  This
+    implementation also uses pthread_cond_wait which has tested to not be a
+    problem.
+*/
 
 namespace __cxxabiv1
 {





More information about the cfe-commits mailing list