Joedb 9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
local_concurrency.cpp
Go to the documentation of this file.
2
4
5#include <chrono>
6#include <thread>
7
8/////////////////////////////////////////////////////////////////////////////
9static int local_concurrency(int argc, char **argv)
10/////////////////////////////////////////////////////////////////////////////
11{
12 tutorial::File_Client client("local_concurrency.joedb");
13
14 while (true)
15 {
16 client.transaction([](tutorial::Writable_Database &db)
17 {
18 db.new_person();
19 });
20
21 std::cout << "I have just added one person. Population: ";
22 std::cout << client.get_database().get_person_table().get_size() << '\n';
23 std::this_thread::sleep_for(std::chrono::seconds(1));
24 }
25
26 return 0;
27}
28
29/////////////////////////////////////////////////////////////////////////////
30int main(int argc, char **argv)
31/////////////////////////////////////////////////////////////////////////////
32{
33 return joedb::main_exception_catcher(local_concurrency, argc, argv);
34}
Shortcut to directly build a Client from a file name.
Definition File_Client.h:39
A writable Database constructed from a writable joedb::Buffered_File.
int main()
int main_exception_catcher(int(*main)(int, char **), int argc, char **argv)
Catch exception from main.