1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/libs/interprocess for documentation.
9 //////////////////////////////////////////////////////////////////////////////
11 Remove std::iterator_traits and use pointer_traits
13 What values should take shared memory allocators:
15 propagate_on_container_copy_assignment
16 propagate_on_container_move_assignment
17 propagate_on_container_swap
21 //////////////////////////////////////////////////////////////////////////////
23 //////////////////////////////////////////////////////////////////////////////
29 Tested until FreeBSD 9
31 Shared memory: FreeBSD < 7 filesystem semantics
34 The shm_open() and shm_unlink() functions first appeared in FreeBSD 4.3.
35 The functions were reimplemented as system calls using shared memory
36 objects directly rather than files in FreeBSD 7.0.
38 BUG: MAP_PRIVATE requires read-write access to shared memory object (mapped files work fine)
40 Named semaphore: _POSIX_SEMAPHORES not defined. Limited named semaphore support (short names)
41 Process shared: _POSIX_THREAD_PROCESS_SHARED not defined
54 -> add contiguous_elements option to burst allocation
56 -> Test construct<> with throwing constructors
58 -> Implement zero_memory flag for allocation_command
60 -> The general allocation funtion can be improved with some fixed size allocation bins.
62 -> Adapt error reporting to TR1 system exceptions
64 -> Improve exception messages
66 -> Movability of containers should depend on the no-throw guarantee of allocators copy constructor
68 -> Check self-assignment for vectors
70 -> Update writing a new memory allocator explaining new functions (like alignment)
72 -> private node allocators could take the number of nodes as a runtime parameter.
74 -> Explain how to build intrusive indexes.
76 -> Add intrusive index types as available indexes.
78 -> Add maximum alignment allocation limit in PageSize bytes. Otherwise, we can't
79 guarantee alignment for process-shared allocations.
81 -> Add default algorithm and index types. The user does not need to know how are
84 -> Pass max size check in allocation to node pools
86 -> Use in-place expansion capabilities to shrink_to_fit and reserve functions
87 from iunordered_index.
89 -> change unique_ptr to avoid using compressed_pair
91 -> Improve unique_ptr test to test move assignment and other goodies like assigment from null
93 -> barrier_test fails on MacOS X on PowerPC.
95 -> use virtual functions to minimize template explosion in managed classes
97 -> Insertions with InpIt are not tested in containers
99 -> Run tests with rvalue reference compilers with no variadic insertions
101 -> find a way to pass security attributes to shared memory
103 -> Implement vector with memcpy/memmove for trivially copyable types.
105 -> flat_xxx constructors are not documented
107 -> operator >> and similar need moved_value
109 -> rvalue reference enabled compilers are not optimized with has_move_emulation_enabled and move_iterator
111 -> Add allocator test template that test all new functions (allocate_many, etc.)
113 -> MacOS shm_open is non-conformant. Is there a way to know the size of a shared memory object?
115 -> swap() of multiallocaiton iterator is wrong. Try to reimplement it with slist
117 -> Could the mapped_file constructor allow a wchar_t filename on Windows?
118 Or some cross-platform way to get Unicode support?
120 -> map::node_ptr p = m.create_node(my_special_cheap_key_value, mv1, mv2);
121 //We would need to unconst-cast...
122 const_cast<Key&>(p->first) = modify( p->second );
123 m.insert( boost::move(p) );
125 -> I found some bug in the interprocess library. I use
126 boost::interprocess::managed_mapped_file class and
127 managed_mapped_file::shrink_to_fit() method to decrease the size of file
128 on the disk. It works good but the thread hang up on shrink_to_fit() call
129 if the file exists already and it's size is zero. It makes me check the
130 file existance and it's size before shrink_to_fit() call.
133 -> Ticket URL: <https://svn.boost.org/trac/boost/ticket/3375>
135 ->Robust mutex emulation:
141 Use intermodule singleton to store the lock file name
148 lock_own_unique_file();
181 if(check_if_owner_dead_and_take_ownership_atomically()){
186 CHECK_IF_OWNER_DEAD_AND_TAKE_OWNERSHIP_ATOMICALLY
189 old_owner = read_owner_atomically()
190 if(check_owner_unique_resource_is_dead(old_owner){
193 }while(cas(old_owner, cur_owner) == old_owner);
196 CHECK_OWNER_UNIQUE_RESOURCE_IS_DEAD(owner)
198 file = file_to_owner(owner);
199 if(file_exists(file)){
201 write_owner_atomically();
211 class MyRobustMutexLockFile
216 MyRobustMutexLockFile()
218 //loop create_and_lock because another process
219 //can lock and erase it
221 //better create, lock and rename?
222 fd = create_file(lockfilename);
225 int fd2 = create_exclusive(lockfilename);
231 else if(already_exist_error){ //must already exist
241 ~MyRobustMutexLockFile()
244 //No race condition because
245 //if any other thread tries to create the file
246 //the shm has a lock so constructor/destructor is serialized
250 ipcdetail::intermodule_singleton<MyRobustMutexLockFile>::get();