mirror of https://github.com/trapexit/mergerfs.git
Antonio SJ Musumeci
8 years ago
7 changed files with 261 additions and 17 deletions
-
2src/create.cpp
-
7src/fileinfo.hpp
-
12src/fs_path.hpp
-
49src/mutex.hpp
-
2src/open.cpp
-
90src/read.cpp
-
116src/read_buf.cpp
@ -0,0 +1,49 @@ |
|||
/*
|
|||
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link> |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted, provided that the above |
|||
copyright notice and this permission notice appear in all copies. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|||
*/ |
|||
|
|||
#ifndef __MUTEX_HPP__
|
|||
#define __MUTEX_HPP__
|
|||
|
|||
#include <pthread.h>
|
|||
|
|||
namespace mergerfs |
|||
{ |
|||
namespace mutex |
|||
{ |
|||
class Guard |
|||
{ |
|||
public: |
|||
Guard(pthread_mutex_t &lock) |
|||
: _lock(&lock) |
|||
{ |
|||
pthread_mutex_lock(_lock); |
|||
} |
|||
|
|||
~Guard() |
|||
{ |
|||
pthread_mutex_unlock(_lock); |
|||
} |
|||
|
|||
private: |
|||
Guard(); |
|||
|
|||
private: |
|||
pthread_mutex_t *_lock; |
|||
}; |
|||
} |
|||
} |
|||
|
|||
#endif
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue