GCC Code Coverage Report


Directory: ./
File: demos/wait_for_segment.cpp
Date: 2022-06-30 06:29:57
Exec Total Coverage
Lines: 0 9 0.0%
Branches: 0 34 0.0%

Line Branch Exec Source
1 /**
2 * @file non_existing_segment.cpp
3 * @author Vincent Berenz
4 * @license License BSD-3-Clause
5 * @copyright Copyright (c) 2020, New York University and Max Planck
6 * Gesellschaft.
7 * @date 2020-10-22
8 *
9 * @brief checks exceptions are throwm when
10 * reading non existing segment
11 */
12
13 #include <signal.h>
14 #include <unistd.h>
15 #include <iostream>
16 #include <vector>
17 #include "shared_memory/shared_memory.hpp"
18
19 int main()
20 {
21 std::string segment_id{"wait_for_segment_demo"};
22
23 bool created = shared_memory::wait_for_segment(segment_id, 1);
24 if (!created)
25 {
26 std::cout << "\nsegment was not created on time !\n"
27 << "waiting again, but not timeout"
28 << "\n";
29 }
30 else
31 {
32 std::cout << "\nsegment id " << segment_id << " exits !\n";
33 }
34
35 std::cout << "waiting for " << segment_id << " ... \n";
36 created = shared_memory::wait_for_segment(segment_id);
37 std::cout << segment_id << " created !\n\n";
38 }
39