Joedb
9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
src
joedb
ui
write_lock.cpp
Go to the documentation of this file.
1
#include "
joedb/journal/File.h
"
2
#include "
joedb/ui/main_exception_catcher.h
"
3
4
#include <iostream>
5
6
namespace
joedb
7
{
8
/////////////////////////////////////////////////////////////////
9
static
int
main
(
int
argc,
char
**argv)
10
/////////////////////////////////////////////////////////////////
11
{
12
if
(argc < 2)
13
{
14
std::cerr <<
"usage: "
<< argv[0] <<
" <file_name>\n"
;
15
return
1;
16
}
17
18
const
char
*
const
file_name = argv[1];
19
20
std::cout <<
"Locking "
<< file_name <<
"..."
;
21
std::cout.flush();
22
23
File
lock(file_name,
Open_Mode::write_lock
);
24
25
std::cout <<
"\nLocked. Enter to stop."
;
26
std::cout.flush();
27
std::cin.get();
28
29
return
0;
30
}
31
}
32
33
//////////////////////////////////////////////////////////////////
34
int
main
(
int
argc,
char
**argv)
35
//////////////////////////////////////////////////////////////////
36
{
37
joedb::main_exception_catcher
(joedb::main, argc, argv);
38
}
File.h
main
int main()
Definition
concurrency_tutorial.cpp:6
joedb::Open_Mode::write_lock
@ write_lock
like write_existing_or_create_new, but waits instead of failing if already locked
joedb::main_exception_catcher
int main_exception_catcher(int(*main)(int, char **), int argc, char **argv)
Catch exception from main.
Definition
main_exception_catcher.cpp:12
main_exception_catcher.h
joedb
Definition
Blob.h:7
joedb::File
JOEDB_FILE File
Definition
File.h:25
Generated by
1.9.8