37{
38 typedef long unsigned int t_int;
40 std::vector<t_int> compindices ( boost::num_vertices ( G ) );
41 t_int total_connected = boost::connected_components ( G, &compindices[0] );
42
43 std::vector<gtool::t_graph> components ( total_connected );
44 std::vector<gtool::t_registry> component_registries ( total_connected );
45
46
47 for ( t_int vector_i = 0; vector_i != compindices.size(); ++vector_i )
48 {
49 t_int component_j = compindices[vector_i];
53 components[component_j],
55 { oname, cname } ),
56 component_registries[component_j] );
57 }
58
59
60
62
63 typedef std::future<void> t_futuwrite;
64 std::vector<std::future<void>> punits;
65
66 unsigned long long int c = 0;
67
68 for ( auto const & g : components )
69 {
70 size_t const component_size = g.vertex_set().size();
71
74 {
75 if ( --max_punits )
76 {
77 std::string output_file
78 {
this_dest_prefix + std::string (
"_" ) + std::to_string ( ++c ) + std::string (
".dot" ) };
79
80 try
81 {
82 punits.push_back ( std::async ( std::launch::async,
graph::write, g, output_file ) );
83 }
84 catch ( std::system_error const & e )
85 {
86 if ( e.code() == std::errc::resource_unavailable_try_again )
87 {
88
90 "Could not launch another thread", e.what(), "for file:", output_file,
91 "try to launch in deferred" );
92
93 punits.push_back (
94 std::async ( std::launch::deferred,
graph::write, g, output_file ) );
95
97 "File write policy change", "Program execution correction", " for file:",
98 output_file, " launched in deferred" );
99
100 }
101 else
102 {
103 throw e;
104 }
105 }
106 }
107 else
108 {
109
110
111
112
113 punits.clear();
115 }
116 }
117 }
118
119 return EXIT_SUCCESS;
120}
static configobject::tref get(dbe::cokey const &desc)
#define GTOOL_MAX_THREADS