[
https://issues.apache.org/jira/browse/THRIFT-490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12706653#action_12706653
]
David Reiss commented on THRIFT-490:
------------------------------------
You've got it right. The macros are to prevent uses like...
{code}
{
Guard(myMutex);
useSharedStructure();
}
{code}
which is invalid because the temporary Guard object is destroyed before the
call to useSharedStructure.
> What are the intended uses for Guard and RWGuard (defined in Mutex.h)
> ---------------------------------------------------------------------
>
> Key: THRIFT-490
> URL: https://issues.apache.org/jira/browse/THRIFT-490
> Project: Thrift
> Issue Type: Question
> Components: Library (C++)
> Affects Versions: 0.1
> Environment: Mac OS X 10.5.6
> Reporter: Rush Manbert
>
> The Guard and RWGuard classes are defined much like the Synchronized class,
> but there are also two macros defined, Guard(m) and RWGuard(m) which cause a
> compile error if you try to declare a Guard or RWGuard on the stack.
> To me, these look like scoped mutex locks that would be used like this:
> {
> Guard g(myMutex);
> }
> which is again just like the use of Synchronized.
> Have I missed something? What is the intended usage for these classes? I need
> to know because I'm writing tests for them so I can test my Boost Mutex and
> ReadWriteMutex implementations.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.