Open Bug 775106 Opened 7 years ago Updated 7 years ago

Migrate RwAutoLockRead/Write class wrappers for PR_RWLock*() from dom/camera/GonkCameraControl.cpp

Categories

(Core :: MFBT, defect, minor)

defect
Not set
minor

Tracking

()

People

(Reporter: mikeh, Unassigned)

References

Details

Implemented this for DOM camera support:

class RwAutoLockRead
{
public:
  RwAutoLockRead(PRRWLock* aRwLock)
    : mRwLock(aRwLock)
  {
    PR_RWLock_Rlock(mRwLock);
  }

  ~RwAutoLockRead()
  {
    PR_RWLock_Unlock(mRwLock);
  }

protected:
  PRRWLock *mRwLock;
};

class RwAutoLockWrite
{
public:
  RwAutoLockWrite(PRRWLock* aRwLock)
    : mRwLock(aRwLock)
  {
    PR_RWLock_Wlock(mRwLock);
  }

  ~RwAutoLockWrite()
  {
    PR_RWLock_Unlock(mRwLock);
  }

protected:
  PRRWLock *mRwLock;
};

May be useful to others, should migrate to a more useful location once DOM camera supports lands.
(In reply to Mike Habicher [:mikeh] from comment #0)

> May be useful to others, should migrate to a more useful location once DOM
> camera supports lands.

*support.
What use does that have, when you have a separate class for read and write lock?

Anyways, this should be implemented on top of bug 773491
Component: mozglue → MFBT
Depends on: 773491
(In reply to Mike Hommey [:glandium] from comment #2)
> What use does that have, when you have a separate class for read and write lock?

They both operate on the same lock (created elsewhere), but give the lock the usual C++ scope management.
Component: MFBT → mozglue
Depends on: 740997
No longer depends on: 773491
Component: mozglue → MFBT
Depends on: 773491
You need to log in before you can comment on or make changes to this bug.