The Pedigree Project  0.1
LockedFile.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef LOCKED_FILE_H
21 #define LOCKED_FILE_H
22 
23 #include "pedigree/kernel/process/Mutex.h"
24 #include "pedigree/kernel/processor/types.h"
25 
26 class File;
27 
33 {
34  public:
36  LockedFile(File *pFile);
37 
40 
42  LockedFile &operator=(const LockedFile &c);
44 
46  bool lock(bool bBlock = false);
47 
49  void unlock();
50 
55  File *getFile();
56 
58  size_t getLocker();
59 
60  private:
62  LockedFile();
63 
68 
70  bool m_bLocked;
71 
73  size_t m_LockerPid;
74 
76 #ifdef THREADS
78 #endif
79 };
80 
81 #endif
File * m_File
Definition: LockedFile.h:67
Definition: Mutex.h:58
size_t getLocker()
Definition: LockedFile.cc:101
size_t m_LockerPid
Definition: LockedFile.h:73
File * getFile()
Definition: LockedFile.cc:87
bool lock(bool bBlock=false)
Definition: LockedFile.cc:55
Mutex m_Lock
Definition: LockedFile.h:77
LockedFile & operator=(const LockedFile &c)
bool m_bLocked
Definition: LockedFile.h:70
void unlock()
Definition: LockedFile.cc:76
Definition: File.h:66