Giriş
boost interprocess sadece header dosyalardan oluşur.
boost ile shared memory kullanmak için şu adımlar izlenmeli.
1. Önce bir shared memory alanı yaratılmalı.
2. Allocator yarat.
3. Container yarat
4. Diğer uygulamalar ile eşzamanlılığı sağlamak için bir interprocess mutex kullanılmalı.
Daha kolay kodlamak için şu satır dahil edilir.
boost interprocess shared memory yazısına taşıdım.
remove_shared_memory_on_destroy sınıfı
Aslında yardımcı sınıf gibi düşünülebilir. Nesne yok olunca shared memory belleğinin de silinmesini garanti eder.
managed_shared_memory Sınıfı yazısına taşıdım.
xsi_shared_memory Sınıfı
boost interprocess shared memory yazısına taşıdım.
windows_shared_memory Sınıfı
boost interprocess shared memory yazısına taşıdım.
void_allocator sınıfı
Şu satırı dahil ederiz.
Şu satırı dahil ederiz.
vector sınıfı
Şu satırı dahil ederiz.
Şu satırı dahil ederiz.
Şu satırı dahil ederiz.
constructor
Şöyle yaparız.
remove metodu
boost interprocess sadece header dosyalardan oluşur.
boost ile shared memory kullanmak için şu adımlar izlenmeli.
1. Önce bir shared memory alanı yaratılmalı.
2. Allocator yarat.
3. Container yarat
4. Diğer uygulamalar ile eşzamanlılığı sağlamak için bir interprocess mutex kullanılmalı.
Daha kolay kodlamak için şu satır dahil edilir.
using boost::interprocess;boost interprocess shared memory yazısına taşıdım.
remove_shared_memory_on_destroy sınıfı
Aslında yardımcı sınıf gibi düşünülebilir. Nesne yok olunca shared memory belleğinin de silinmesini garanti eder.
remove_shared_memory_on_destroy remove_on_destroy("MySharedMemory");
{
  ...
}managed_shared_memory Sınıfı yazısına taşıdım.
xsi_shared_memory Sınıfı
boost interprocess shared memory yazısına taşıdım.
windows_shared_memory Sınıfı
boost interprocess shared memory yazısına taşıdım.
Şu satırı dahil ederiz.
#include <boost/interprocess/allocators/allocator.hpp>void_allocator alloc_inst (segment.get_segment_manager());Şu satırı dahil ederiz.
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/containers/list.hpp>namespace bip = boost::interprocess;
typedef int my_big_struct;
namespace shared {
  using segment = bip::managed_mapped_file;
  using manager = segment::segment_manager;
  template <typename T> using alloc = bip::allocator<T, manager>;
  template <typename T> using list  = boost::interprocess::list<T, alloc<T> >;
}
int main()
{
  using List   = shared::list<my_big_struct>;
  using ItList = shared::list<List::const_iterator>;
  ...
}shared::segment segment = ...;
auto& a = *segment.find_or_construct<List>("a")(segment.get_segment_manager());
auto& b = *segment.find_or_construct<ItList>("b")(segment.get_segment_manager());vector sınıfı
Şu satırı dahil ederiz.
#include <boost/interprocess/containers/vector.hpp>Şu satırı dahil ederiz.
#include <boost/interprocess/containers/map.hpp>Şu satırı dahil ederiz.
#include <boost/interprocess/containers/string.hpp>typedef bi::allocator<char, bi::managed_shared_memory::segment_manager> 
CharAllocator; 
typedef bi::basic_string<char, std::char_traits<char>, CharAllocator> my_string;constructor
Şöyle yaparız.
named_condition cond (create_only_t(), "...");
Şöyle yaparız.
boost::interprocess::named_mutex* mut
 (boost::interprocess::create_only_t(), "...");
Şöyle yaparız.
constructor
Şöyle tanımlarız.
boost::interprocess::named_mutex::remove("..."); constructor
Şöyle tanımlarız.
#include <boost/interprocess/sync/named_recursive_mutex.hpp>
boost::interprocess::named_recursive_mutex mut(
    boost::interprocess::open_or_create, "MY_SHARED_MUTEX_123"); 
 
Merhaba,
YanıtlaSilhttp://www.ibm.com/developerworks/aix/library/au-concurrent_boost/
Goz atmak isteyebilirsiniz.