Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57862 - trunk/libs/thread/doc
From: anthony_at_[hidden]
Date: 2009-11-23 06:31:08


Author: anthonyw
Date: 2009-11-23 06:31:08 EST (Mon, 23 Nov 2009)
New Revision: 57862
URL: http://svn.boost.org/trac/boost/changeset/57862

Log:
Clarify note on call_once

Text files modified:
   trunk/libs/thread/doc/once.qbk | 10 ++++++++--
   1 files changed, 8 insertions(+), 2 deletions(-)

Modified: trunk/libs/thread/doc/once.qbk
==============================================================================
--- trunk/libs/thread/doc/once.qbk (original)
+++ trunk/libs/thread/doc/once.qbk 2009-11-23 06:31:08 EST (Mon, 23 Nov 2009)
@@ -45,8 +45,14 @@
 
 [[Throws:] [`thread_resource_error` when the effects cannot be achieved. or any exception propagated from `func`.]]
 
-[[Note:] [If the function passed to `call_once` also calls `call_once`
-passing the same `once_flag` object then deadlock will occur.]]
+[[Note:] [The function passed to `call_once` must not also call
+`call_once` passing the same `once_flag` object. This may cause
+deadlock, or invoking the passed function a second time. The
+alternative is to allow the second call to return immediately, but
+that assumes the code knows it has been called recursively, and can
+proceed even though the call to `call_once` didn't actually call the
+function, in which case it could also avoid calling `call_once`
+recursively.]]
 
 ]
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk