Turi Create  4.0
shmipc_garbage_collect.hpp
1 /* Copyright © 2017 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 #ifndef TURI_SHMIPC_GARBAGE_COLLECT_HPP
7 #define TURI_SHMIPC_GARBAGE_COLLECT_HPP
8 #include <memory>
9 namespace turi {
10 namespace shmipc {
11 
12 // forward decl of raii deleter
13 struct raii_deleter;
14 
15 /**
16  * \ingroup shmipc
17  * For a given shared memory segment name, m_name, this function
18  * returns a scoped deleter object which unlinks the shared memory segment
19  * on destruction.
20  *
21  * Internally, the RAII deleter contains a pair of a shared memory filename and
22  * a "tag" filename which is used to indicate that the shared memory file
23  * exists. The tag filename is used in shared memory garbage collection and is
24  * located as [system temp directory]/glshm_[userid]/[shmname]
25  *
26  * The reason for having a directory for each userid is to avoid permission
27  * issues. Each tag file contains inside of it, the PID of the server process.
28  */
29 std::shared_ptr<raii_deleter>
30 register_shared_memory_name(std::string m_name);
31 
32 /**
33  * \ingroup shmipc
34  * Collects all unused shared memory segments
35  */
36 void garbage_collect();
37 } // shmipc
38 } // turicreate
39 #endif
std::shared_ptr< raii_deleter > register_shared_memory_name(std::string m_name)
void garbage_collect()