btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / system / kernel / vm / PageCacheLocker.h
blob36a21b2c7b917ff197f235869061e5adf1b04c29
1 /*
2 * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef PAGE_CACHE_LOCKER_H
6 #define PAGE_CACHE_LOCKER_H
9 #include <null.h>
11 struct vm_page;
14 class PageCacheLocker {
15 public:
16 inline PageCacheLocker(vm_page* page,
17 bool dontWait = true);
18 inline ~PageCacheLocker();
20 bool IsLocked() { return fPage != NULL; }
22 bool Lock(vm_page* page, bool dontWait = true);
23 void Unlock();
25 private:
26 bool _IgnorePage(vm_page* page);
28 vm_page* fPage;
32 PageCacheLocker::PageCacheLocker(vm_page* page, bool dontWait)
34 fPage(NULL)
36 Lock(page, dontWait);
40 PageCacheLocker::~PageCacheLocker()
42 Unlock();
46 #endif // PAGE_CACHE_LOCKER_H