From patchwork Wed May 25 23:43:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 97441 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id C119AB6F87 for ; Thu, 26 May 2011 09:44:03 +1000 (EST) Received: (qmail 8089 invoked by alias); 25 May 2011 23:43:59 -0000 Received: (qmail 8068 invoked by uid 22791); 25 May 2011 23:43:57 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, TW_UQ X-Spam-Check-By: sourceware.org Received: from mail-pw0-f47.google.com (HELO mail-pw0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 25 May 2011 23:43:36 +0000 Received: by pwj9 with SMTP id 9so108792pwj.20 for ; Wed, 25 May 2011 16:43:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.217.18 with SMTP id p18mr23644wfg.248.1306367015379; Wed, 25 May 2011 16:43:35 -0700 (PDT) Received: by 10.142.69.21 with HTTP; Wed, 25 May 2011 16:43:35 -0700 (PDT) Date: Thu, 26 May 2011 00:43:35 +0100 Message-ID: Subject: [v3] fix comments From: Jonathan Wakely To: "libstdc++" , gcc-patches Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch fixes a load of spelling mistakes in comments, so my inner pedant can sleep at night ;) 2011-05-26 Jonathan Wakely * libsupc++/guard.cc: Fix comments. No code changes, but tested anyway on x86_64-linux, committed to trunk Index: libsupc++/guard.cc =================================================================== --- libsupc++/guard.cc (revision 174240) +++ libsupc++/guard.cc (working copy) @@ -85,7 +85,7 @@ # if defined(__GTHREAD_HAS_COND) && !defined(_GLIBCXX_USE_FUTEX) namespace { - // A single conditional variable controlling all static initializations. + // A single condition variable controlling all static initializations. static __gnu_cxx::__cond* static_cond; // using a fake type to avoid initializing a static class. @@ -136,7 +136,7 @@ #endif /* __GTHREADS */ // -// Here are C++ run-time routines for guarded initiailization of static +// Here are C++ run-time routines for guarded initialization of static // variables. There are 4 scenarios under which these routines are called: // // 1. Threads not supported (__GTHREADS not defined) @@ -147,24 +147,24 @@ // // The old code supported scenarios 1-3 but was broken since it used a global // mutex for all threads and had the mutex locked during the whole duration of -// initlization of a guarded static variable. The following created a dead-lock -// with the old code. +// initialization of a guarded static variable. The following created a +// dead-lock with the old code. // // Thread 1 acquires the global mutex. // Thread 1 starts initializing static variable. // Thread 1 creates thread 2 during initialization. -// Thread 2 attempts to acuqire mutex to initialize another variable. +// Thread 2 attempts to acquire mutex to initialize another variable. // Thread 2 blocks since thread 1 is locking the mutex. // Thread 1 waits for result from thread 2 and also blocks. A deadlock. // -// The new code here can handle this situation and thus is more robust. Howere, -// we need to use the POSIX thread conditional variable, which is not supported +// The new code here can handle this situation and thus is more robust. However, +// we need to use the POSIX thread condition variable, which is not supported // in all platforms, notably older versions of Microsoft Windows. The gthr*.h // headers define a symbol __GTHREAD_HAS_COND for platforms that support POSIX -// like conditional variables. For platforms that do not support conditional +// like condition variables. For platforms that do not support condition // variables, we need to fall back to the old code. -// If _GLIBCXX_USE_FUTEX, no global mutex or conditional variable is used, +// If _GLIBCXX_USE_FUTEX, no global mutex or condition variable is used, // only atomic operations are used together with futex syscall. // Valid values of the first integer in guard are: // 0 No thread encountered the guarded init @@ -211,7 +211,7 @@ #endif } - // acuire() is a helper function used to acquire guard if thread support is + // acquire() is a helper function used to acquire guard if thread support is // not compiled in or is compiled in but not enabled at run-time. static int acquire(__guard *g) @@ -284,7 +284,7 @@ { // The guarded static is currently being initialized by // another thread, so we release mutex and wait for the - // conditional variable. We will lock the mutex again after + // condition variable. We will lock the mutex again after // this. get_static_cond().wait_recursive(&get_static_mutex()); } @@ -295,7 +295,7 @@ } # else // This provides compatibility with older systems not supporting - // POSIX like conditional variables. + // POSIX like condition variables. if (acquire(g)) { mw.unlock = false; @@ -335,7 +335,7 @@ set_init_in_progress_flag(g, 0); // If we abort, we still need to wake up all other threads waiting for - // the conditional variable. + // the condition variable. get_static_cond().broadcast(); return; } @@ -344,7 +344,7 @@ set_init_in_progress_flag(g, 0); #if defined(__GTHREADS) && !defined(__GTHREAD_HAS_COND) // This provides compatibility with older systems not supporting POSIX like - // conditional variables. + // condition variables. if (__gthread_active_p ()) static_mutex->unlock(); #endif @@ -385,7 +385,7 @@ #if defined(__GTHREADS) && !defined(__GTHREAD_HAS_COND) // This provides compatibility with older systems not supporting POSIX like - // conditional variables. + // condition variables. if (__gthread_active_p()) static_mutex->unlock(); #endif