CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009
    Posts
    2

    Question about atomic_cas_ptr

    Hi,
    I am using atomic_cas_ptr from atomic.h provided by solaris 10 for one of my implementations to do an atomic compare and swap. This function atomic_cas_ptr always returns the old value stored in the target. I was wondering if there is any way we can get a boolean true or false to know whether the CAS succeeded in one atomic function call rather than having to check the value of target after calling atomic_cas_ptr.

    Thanks a lot.

  2. #2
    Join Date
    Nov 2003
    Posts
    1,902

    Re: Question about atomic_cas_ptr

    >> rather than having to check the value of target
    ??
    http://docs.sun.com/app/docs/doc/816...-ptr-9f?a=view
    The old value of the 'target', "at the time of the call", is returned so you can compare it with 'cmp'. If equal then you know that 'newval' was assigned to 'target' ("at the time of the call").

    gg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured