Results 1 to 4 of 4

Thread: RWRecLock - Again

  1. #1
    acbell is offline Registered User
    Name: Andrew Bell
    Organization: Iowa State University
    Project: National Resources Inventory
    Join Date
    Jan 2005
    Location
    Ames, IA, USA
    Posts
    89

    RWRecLock - Again

    Hi,

    There was another thread about this topic, but I would appreciate it if someone could confirm that this was a feature and not a bug.

    This works:

    IceUtil::RWRecMutex::WLock sync(*this);
    IceUtil::RWRecMutex::WLock sync(*this);
    cerr << "Success.\n";

    This doesn't work:

    IceUtil::RWRecMutex::WLock sync(*this);
    IceUtil::RWRecMutex::RLock sync(*this);
    cerr << "Success.\n";

    Even though the read lock is "more permissive" than the write lock.

    Thanks,

  2. #2
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    It is not a bug. Please see this thread:

    http://www.zeroc.com/vbulletin/showthread.php?t=1268

  3. #3
    acbell is offline Registered User
    Name: Andrew Bell
    Organization: Iowa State University
    Project: National Resources Inventory
    Join Date
    Jan 2005
    Location
    Ames, IA, USA
    Posts
    89

    Thanks

    OK,

    Thanks for confirmation on this behavior. I had a little trouble interpreting the response in the referenced thread.

    It would be nice to have some sort of a read lock that DID work inside a write lock:

    obtain write lock
    if (test_function())
    set some value.
    release write lock

    test_function()
    {
    obtain read lock
    return some status info.
    release read lock
    }

    Without this, it makes it kind of a pain to have test functions that can be used in the context of a test/set and outside that context. With the current scheme, you need to put a write lock in your test function, which is more restrictive than necessary.

    Cheers,

  4. #4
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    You can always write a wrapper class for RWRecMutex that implements this behavior. For the RWRecMutex in Ice, we want to stick to Posix semantics, and introduce as little overhead as possible.

    As an aside, can you please update your signature with the project you are working on? Please see this thread for details.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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