The Support Kit: BAutolock

The Support Kit Table of Contents | The Support Kit Index

# BAutolock

Derived from: none

Declared in: be/support/Autolock.h

Library: libbe.so

###### Summary

The BAutolock class provides an easy mechanism for automatically locking and unlocking a BLocker object or, more typically, a BLooper. All you need to do is allocate a BAutolock object on the stack and pass it a target BLocker or BLooper. You may want to make sure the lock is in place before proceeding:

       BAutolock autolocker(myWindow);
       if ( autolocker.IsLocked() ) {
           . . .
       }

When the stack frame is destroyed, the BAutolock object unlocks the target object and then is itself destroyed.

## Constructor and Destructor

### BAutolock()

inline `BAutolock(` BLooper *looper`)`
inline `BAutolock(` BLocker *locker`)`
inline `BAutolock(` BLocker &locker`)`

Locks the target looper or locker object.

### ~BAutolock()

inline `~BAutolock()`

Unlocks the target BLooper or BLocker.

## Member Functions

### IsLocked()

inline bool `IsLocked(`void`)`

Returns `true` if the target BLooper or BLocker is locked, and `false` if not.

The Support Kit Table of Contents | The Support Kit Index

The Be Book,
...in lovely HTML...
for BeOS Release 5.

Copyright © 2000 Be, Inc. All rights reserved..