mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
Changes for official inclusion in the regression tests
[SVN r37591]
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Boost.Interprocess library documentation Jamfile ---------------------------------
|
||||
#
|
||||
# Copyright Ion Gaztañaga 2005-2006. Use, modification and
|
||||
# Copyright Ion Gaztañaga 2005-2007. Use, modification and
|
||||
# distribution is subject to the Boost Software License, Version
|
||||
# 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -27,19 +27,11 @@ doxygen interprocess_doxygen
|
||||
<doxygen:param>EXTRACT_ALL=NO
|
||||
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
|
||||
<doxygen:param>EXTRACT_PRIVATE=NO
|
||||
<doxygen:param>ENABLE_PREPROCESSING=NO
|
||||
<doxygen:param>MACRO_EXPANSION=YES
|
||||
# <doxygen:param>ENABLE_PREPROCESSING=NO
|
||||
# <doxygen:param>MACRO_EXPANSION=YES
|
||||
<doxygen:param>EXPAND_ONLY_PREDEF=YES
|
||||
<doxygen:param>SEARCH_INCLUDES=YES
|
||||
<doxygen:param>INCLUDE_PATH=$(BOOST_ROOT)
|
||||
# <doxygen:param>EXTRACT_ALL=NO
|
||||
# <doxygen:param>HIDE_SCOPE_NAMES=YES
|
||||
# <doxygen:param>HIDE_UNDOC_MEMBERS=YES
|
||||
# <doxygen:param>EXTRACT_PRIVATE=NO
|
||||
# <doxygen:param>ENABLE_PREPROCESSING=YES
|
||||
# <doxygen:param>MACRO_EXPANSION=YES
|
||||
# <doxygen:param>EXPAND_ONLY_PREDEF=YES
|
||||
# <doxygen:param>SEARCH_INCLUDES=YES
|
||||
# <doxygen:param>SEARCH_INCLUDES=YES
|
||||
# <doxygen:param>INCLUDE_PATH=$(BOOST_ROOT)
|
||||
;
|
||||
|
||||
xml interprocess_xml : interprocess.qbk ;
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include "doc_anonymous_condition_shared_data.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(create_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Set size
|
||||
shm.truncate(sizeof(trace_queue));
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
trace_queue * data = new (addr) trace_queue;
|
||||
|
||||
const int NumMsg = 100;
|
||||
|
||||
for(int i = 0; i < NumMsg; ++i){
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
if(data->message_in){
|
||||
data->cond_full.wait(lock);
|
||||
}
|
||||
if(i == (NumMsg-1))
|
||||
std::sprintf(data->items, "%s", "last message");
|
||||
else
|
||||
std::sprintf(data->items, "%s_%d", "my_trace", i);
|
||||
|
||||
//Notify to the other process that there is a message
|
||||
data->cond_empty.notify_one();
|
||||
|
||||
//Mark message buffer as full
|
||||
data->message_in = true;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include "doc_anonymous_condition_shared_data.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(open_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Obtain a pointer to the shared structure
|
||||
trace_queue * data = static_cast<trace_queue*>(addr);
|
||||
|
||||
//Print messages until the other process marks the end
|
||||
bool end_loop = false;
|
||||
do{
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
if(!data->message_in){
|
||||
data->cond_empty.wait(lock);
|
||||
}
|
||||
if(std::strcmp(data->items, "last message") == 0){
|
||||
end_loop = true;
|
||||
}
|
||||
else{
|
||||
//Print the message
|
||||
std::cout << data->items << std::endl;
|
||||
//Notify the other process that the buffer is empty
|
||||
data->message_in = false;
|
||||
data->cond_full.notify_one();
|
||||
}
|
||||
}
|
||||
while(!end_loop);
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#include <boost/interprocess/sync/interprocess_mutex.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_condition.hpp>
|
||||
|
||||
struct trace_queue
|
||||
{
|
||||
enum { LineSize = 100 };
|
||||
|
||||
trace_queue()
|
||||
: message_in(false)
|
||||
{}
|
||||
|
||||
//Mutex to protect access to the queue
|
||||
boost::interprocess::interprocess_mutex mutex;
|
||||
|
||||
//Condition to wait when the queue is empty
|
||||
boost::interprocess::interprocess_condition cond_empty;
|
||||
|
||||
//Condition to wait when the queue is full
|
||||
boost::interprocess::interprocess_condition cond_full;
|
||||
|
||||
//Items to fill
|
||||
char items[LineSize];
|
||||
|
||||
//Is there any message
|
||||
bool message_in;
|
||||
};
|
||||
@@ -1,65 +0,0 @@
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include "doc_anonymous_mutex_shared_data.hpp"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(create_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Set size
|
||||
shm.truncate(sizeof(shared_memory_log));
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
shared_memory_log * data = new (addr) shared_memory_log;
|
||||
|
||||
//Write some logs
|
||||
for(int i = 0; i < shared_memory_log::NumItems; ++i){
|
||||
//Lock the mutex
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
std::sprintf(data->items[(data->current_line++) % shared_memory_log::NumItems]
|
||||
,"%s_%d", "process_a", i);
|
||||
if(i == (shared_memory_log::NumItems-1))
|
||||
data->end_a = true;
|
||||
//Mutex is released here
|
||||
}
|
||||
|
||||
//Wait until the other process ends
|
||||
while(1){
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
if(data->end_b)
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include "doc_anonymous_mutex_shared_data.hpp"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Open the shared memory object.
|
||||
shared_memory_object shm
|
||||
(open_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
shared_memory_log * data = static_cast<shared_memory_log*>(addr);
|
||||
|
||||
//Write some logs
|
||||
for(int i = 0; i < 100; ++i){
|
||||
//Lock the mutex
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
std::sprintf(data->items[(data->current_line++) % shared_memory_log::NumItems]
|
||||
,"%s_%d", "process_a", i);
|
||||
if(i == (shared_memory_log::NumItems-1))
|
||||
data->end_b = true;
|
||||
//Mutex is released here
|
||||
}
|
||||
|
||||
//Wait until the other process ends
|
||||
while(1){
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
if(data->end_a)
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#include <boost/interprocess/sync/interprocess_mutex.hpp>
|
||||
|
||||
struct shared_memory_log
|
||||
{
|
||||
enum { NumItems = 100 };
|
||||
enum { LineSize = 100 };
|
||||
|
||||
shared_memory_log()
|
||||
: current_line(0)
|
||||
, end_a(false)
|
||||
, end_b(false)
|
||||
{}
|
||||
|
||||
//Mutex to protect access to the queue
|
||||
boost::interprocess::interprocess_mutex mutex;
|
||||
|
||||
//Items to fill
|
||||
char items[NumItems][LineSize];
|
||||
int current_line;
|
||||
bool end_a;
|
||||
bool end_b;
|
||||
};
|
||||
@@ -1,56 +0,0 @@
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <iostream>
|
||||
#include "doc_anonymous_semaphore_shared_data.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(create_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Set size
|
||||
shm.truncate(sizeof(shared_memory_buffer));
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
shared_memory_buffer * data = new (addr) shared_memory_buffer;
|
||||
|
||||
const int NumMsg = 100;
|
||||
|
||||
//Insert data in the array
|
||||
for(int i = 0; i < NumMsg; ++i){
|
||||
data->nempty.wait();
|
||||
data->mutex.wait();
|
||||
data->items[i % shared_memory_buffer::NumItems] = i;
|
||||
data->mutex.post();
|
||||
data->nstored.post();
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <iostream>
|
||||
#include "doc_anonymous_semaphore_shared_data.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(open_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Obtain the shared structure
|
||||
shared_memory_buffer * data = static_cast<shared_memory_buffer*>(addr);
|
||||
|
||||
const int NumMsg = 100;
|
||||
|
||||
int extracted_data [NumMsg];
|
||||
|
||||
//Extract the data
|
||||
for(int i = 0; i < NumMsg; ++i){
|
||||
data->nstored.wait();
|
||||
data->mutex.wait();
|
||||
extracted_data[i] = data->items[i % shared_memory_buffer::NumItems];
|
||||
data->mutex.post();
|
||||
data->nempty.post();
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#include <boost/interprocess/sync/interprocess_semaphore.hpp>
|
||||
|
||||
struct shared_memory_buffer
|
||||
{
|
||||
enum { NumItems = 10 };
|
||||
|
||||
shared_memory_buffer()
|
||||
: mutex(1), nempty(NumItems), nstored(0)
|
||||
{}
|
||||
|
||||
//Semaphores to protect and synchronize access
|
||||
boost::interprocess::interprocess_semaphore
|
||||
mutex, nempty, nstored;
|
||||
|
||||
//Items to fill
|
||||
int items[NumItems];
|
||||
};
|
||||
@@ -1,65 +0,0 @@
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include "doc_upgradable_mutex_shared_data.hpp"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(create_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Set size
|
||||
shm.truncate(sizeof(shared_data));
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
shared_data * data = new (addr) shared_data;
|
||||
|
||||
//Write some logs
|
||||
for(int i = 0; i < shared_data::NumItems; ++i){
|
||||
//Lock the upgradable_mutex
|
||||
scoped_lock<interprocess_upgradable_mutex> lock(data->upgradable_mutex);
|
||||
std::sprintf(data->items[(data->current_line++) % shared_data::NumItems]
|
||||
,"%s_%d", "process_a", i);
|
||||
if(i == (shared_data::NumItems-1))
|
||||
data->end_a = true;
|
||||
//Mutex is released here
|
||||
}
|
||||
|
||||
//Wait until the other process ends
|
||||
while(1){
|
||||
scoped_lock<interprocess_upgradable_mutex> lock(data->upgradable_mutex);
|
||||
if(data->end_b)
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include "doc_upgradable_mutex_shared_data.hpp"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Open the shared memory object.
|
||||
shared_memory_object shm
|
||||
(open_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
shared_data * data = static_cast<shared_data*>(addr);
|
||||
|
||||
//Write some logs
|
||||
for(int i = 0; i < 100; ++i){
|
||||
//Lock the upgradable_mutex
|
||||
scoped_lock<interprocess_upgradable_mutex> lock(data->upgradable_mutex);
|
||||
std::sprintf(data->items[(data->current_line++) % shared_data::NumItems]
|
||||
,"%s_%d", "process_a", i);
|
||||
if(i == (shared_data::NumItems-1))
|
||||
data->end_b = true;
|
||||
//Mutex is released here
|
||||
}
|
||||
|
||||
//Wait until the other process ends
|
||||
while(1){
|
||||
scoped_lock<interprocess_upgradable_mutex> lock(data->upgradable_mutex);
|
||||
if(data->end_a)
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/smart_ptr/intrusive_ptr.hpp>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
namespace N {
|
||||
|
||||
//A class that has an internal reference count
|
||||
class reference_counted_class
|
||||
{
|
||||
private:
|
||||
//Non-copyable
|
||||
reference_counted_class(const reference_counted_class &);
|
||||
//Non-assignable
|
||||
reference_counted_class & operator=(const reference_counted_class &);
|
||||
//A typedef to save typing
|
||||
typedef managed_shared_memory::segment_manager segment_manager;
|
||||
//This is the reference count
|
||||
unsigned int m_use_count;
|
||||
//The segment manager allows deletion from shared memory segment
|
||||
offset_ptr<segment_manager> mp_segment_manager;
|
||||
|
||||
public:
|
||||
//Constructor
|
||||
reference_counted_class(segment_manager *s_mngr)
|
||||
: m_use_count(0), mp_segment_manager(s_mngr){}
|
||||
//Destructor
|
||||
~reference_counted_class(){}
|
||||
|
||||
public:
|
||||
//Returns the reference count
|
||||
unsigned int use_count() const
|
||||
{ return m_use_count; }
|
||||
//Adds a reference
|
||||
inline friend void intrusive_ptr_add_ref(reference_counted_class * p)
|
||||
{ ++p->m_use_count; }
|
||||
//Releases a reference
|
||||
inline friend void intrusive_ptr_release(reference_counted_class * p)
|
||||
{ if(--p->m_use_count == 0) p->mp_segment_manager->destroy_ptr(p); }
|
||||
};
|
||||
|
||||
} //namespace N {
|
||||
|
||||
//A class that has an intrusive pointer to reference_counted_class
|
||||
class intrusive_ptr_owner
|
||||
{
|
||||
typedef intrusive_ptr<N::reference_counted_class,
|
||||
offset_ptr<void> > intrusive_ptr_t;
|
||||
intrusive_ptr_t m_intrusive_ptr;
|
||||
|
||||
public:
|
||||
//Takes a pointer to the reference counted class
|
||||
intrusive_ptr_owner(N::reference_counted_class *ptr)
|
||||
: m_intrusive_ptr(ptr){}
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
shared_memory_object::remove("my_shmem");
|
||||
//Create shared memory
|
||||
managed_shared_memory shmem(create_only, "my_shmem", 10000);
|
||||
//Create the unique reference counted object in shared memory
|
||||
N::reference_counted_class *ref_counted =
|
||||
shmem.construct<N::reference_counted_class>
|
||||
("ref_counted")(shmem.get_segment_manager());
|
||||
//Create an array of ten intrusive pointer owners in shared memory
|
||||
intrusive_ptr_owner *intrusive_owner_array =
|
||||
shmem.construct<intrusive_ptr_owner>
|
||||
(anonymous_instance)[10](ref_counted);
|
||||
//Now test that reference count is ten
|
||||
if(ref_counted->use_count() != 10)
|
||||
return 1;
|
||||
|
||||
//Now destroy the array of intrusive pointer owners
|
||||
//This should destroy every intrusive_ptr and because of
|
||||
//that reference_counted_class will be destroyed
|
||||
shmem.destroy_ptr(intrusive_owner_array);
|
||||
|
||||
//Now the reference counted object should have been destroyed
|
||||
if(shmem.find<intrusive_ptr_owner>("ref_counted").first)
|
||||
return 1;
|
||||
//Success!
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,39 +0,0 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
|
||||
//An special shared memory from which we are
|
||||
//able to allocate raw memory buffers.
|
||||
//First remove any old shared memory of the same name, create
|
||||
//the shared memory segment and initialize needed resources
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
managed_shared_memory segment
|
||||
(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536); //segment size in bytes
|
||||
|
||||
//Allocate a portion of the segment
|
||||
void * shptr = segment.allocate(1024/*bytes to allocate*/);
|
||||
|
||||
//An handle from the base address can identify any byte of the shared
|
||||
//memory segment even if it is mapped in different base addresses
|
||||
managed_shared_memory::handle_t handle = segment.get_handle_from_address(shptr);
|
||||
(void)handle;
|
||||
// Copy message to buffer
|
||||
// . . .
|
||||
// Send handle to other process
|
||||
// . . .
|
||||
// Wait response from other process
|
||||
// . . .
|
||||
|
||||
//Deallocate the portion previously allocated
|
||||
segment.deallocate(shptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,31 +0,0 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
|
||||
//An special shared memory from which we are
|
||||
//able to allocate raw memory buffers.
|
||||
//Connect to the already created shared memory segment
|
||||
//and initialize needed resources
|
||||
managed_shared_memory segment(open_only, "MySharedMemory"); //segment name
|
||||
|
||||
//An handle from the base address can identify any byte of the shared
|
||||
//memory segment even if it is mapped in different base addresses
|
||||
managed_shared_memory::handle_t handle = 0;
|
||||
|
||||
//Wait handle msg from the other process and put it in
|
||||
//"handle" local variable
|
||||
//Get buffer local address from handle
|
||||
void *msg = segment.get_address_from_handle(handle);
|
||||
(void)msg;
|
||||
//Do anything with msg
|
||||
//. . .
|
||||
//Send ack to sender process
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,66 +0,0 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/containers/list.hpp>
|
||||
#include <boost/interprocess/managed_heap_memory.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
typedef list<int, allocator<int, managed_heap_memory::segment_manager> >
|
||||
MyList;
|
||||
|
||||
int main ()
|
||||
{
|
||||
//We will create a buffer of 1000 bytes to store a list
|
||||
managed_heap_memory heap_memory(1000);
|
||||
|
||||
MyList * mylist = heap_memory.construct<MyList>("MyList")
|
||||
(heap_memory.get_segment_manager());
|
||||
|
||||
//Obtain handle, that identifies the list in the buffer
|
||||
managed_heap_memory::handle_t list_handle = heap_memory.get_handle_from_address(mylist);
|
||||
|
||||
//Fill list until there is no more memory in the buffer
|
||||
try{
|
||||
while(1) {
|
||||
mylist->insert(mylist->begin(), 0);
|
||||
}
|
||||
}
|
||||
catch(const bad_alloc &){
|
||||
//memory is full
|
||||
}
|
||||
//Let's obtain the size of the list
|
||||
std::size_t old_size = mylist->size();
|
||||
|
||||
//To make the list bigger, let's increase the heap buffer
|
||||
//in 1000 bytes more.
|
||||
heap_memory.grow(1000);
|
||||
|
||||
//If memory has been reallocated, the old pointer is invalid, so
|
||||
//use previously obtained handle to find the new pointer.
|
||||
mylist = static_cast<MyList *>
|
||||
(heap_memory.get_address_from_handle(list_handle));
|
||||
|
||||
//Fill list until there is no more memory in the buffer
|
||||
try{
|
||||
while(1) {
|
||||
mylist->insert(mylist->begin(), 0);
|
||||
}
|
||||
}
|
||||
catch(const bad_alloc &){
|
||||
//memory is full
|
||||
}
|
||||
|
||||
//Let's obtain the new size of the list
|
||||
std::size_t new_size = mylist->size();
|
||||
|
||||
assert(new_size > old_size);
|
||||
|
||||
//Destroy list
|
||||
heap_memory.destroy_ptr(mylist);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,32 +0,0 @@
|
||||
#include <boost/interprocess/ipc/message_queue.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous message queue
|
||||
message_queue::remove("message_queue");
|
||||
|
||||
//Create a message_queue.
|
||||
message_queue mq
|
||||
(create_only //only create
|
||||
,"message_queue" //name
|
||||
,100 //max message number
|
||||
,sizeof(int) //max message size
|
||||
);
|
||||
|
||||
//Send 100 numbers
|
||||
for(int i = 0; i < 100; ++i){
|
||||
mq.send(&i, sizeof(i), 0);
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#include <boost/interprocess/ipc/message_queue.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Open a message queue.
|
||||
message_queue mq
|
||||
(open_only //only create
|
||||
,"message_queue" //name
|
||||
);
|
||||
|
||||
unsigned int priority;
|
||||
unsigned int recvd_size;
|
||||
|
||||
//Receive 100 numbers
|
||||
for(int i = 0; i < 100; ++i){
|
||||
int number;
|
||||
mq.receive(&number, sizeof(number), recvd_size, priority);
|
||||
if(number != i || recvd_size != sizeof(number))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <utility>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
typedef std::pair<double, int> MyType;
|
||||
|
||||
//An special shared memory where we can
|
||||
//construct objects associated with a name.
|
||||
//First remove any old shared memory of the same name, create
|
||||
//the shared memory segment and initialize needed resources
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
managed_shared_memory segment(
|
||||
create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536); //segment size in bytes
|
||||
|
||||
//Create an object of MyType initialized to {0.0, 0}
|
||||
MyType *instance = segment.construct<MyType>
|
||||
("MyType instance") /*name of the object*/
|
||||
(0.0 /*ctor first argument*/,
|
||||
0 /*ctor second argument*/);
|
||||
|
||||
//Create an array of 10 elements of MyType initialized to {0.0, 0}
|
||||
MyType *array = segment.construct<MyType>
|
||||
("MyType array") /*name of the object*/
|
||||
[10] /*number of elements*/
|
||||
(0.0 /*ctor first argument*/,
|
||||
0 /*ctor second argument*/);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,49 +0,0 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
#include <assert.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
typedef std::pair<double, int> MyType;
|
||||
|
||||
//An special shared memory where we can
|
||||
//construct objects associated with a name.
|
||||
//Connect to the already created shared memory segment
|
||||
//and initialize needed resources
|
||||
managed_shared_memory segment(
|
||||
open_only,
|
||||
"MySharedMemory");
|
||||
|
||||
//Find the array and object
|
||||
std::pair<MyType*, std::size_t> res;
|
||||
res = segment.find<MyType> ("MyType array");
|
||||
|
||||
std::size_t array_len = res.second;
|
||||
//Length should be 10
|
||||
assert(array_len == 10);
|
||||
|
||||
//Find the array and the object
|
||||
res = segment.find<MyType> ("MyType instance");
|
||||
|
||||
std::size_t len = res.second;
|
||||
|
||||
//Length should be 1
|
||||
assert(len == 1);
|
||||
|
||||
//Use data
|
||||
// . . .
|
||||
|
||||
//We're done, delete array from memory
|
||||
segment.destroy<MyType>("MyType array");
|
||||
|
||||
//We're done, delete object from memory
|
||||
segment.destroy<MyType>("MyType instance");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,66 +0,0 @@
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include "doc_anonymous_condition_shared_data.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(create_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Set size
|
||||
shm.truncate(sizeof(trace_queue));
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
trace_queue * data = new (addr) trace_queue;
|
||||
|
||||
const int NumMsg = 100;
|
||||
|
||||
for(int i = 0; i < NumMsg; ++i){
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
if(data->message_in){
|
||||
data->cond_full.wait(lock);
|
||||
}
|
||||
if(i == (NumMsg-1))
|
||||
std::sprintf(data->items, "%s", "last message");
|
||||
else
|
||||
std::sprintf(data->items, "%s_%d", "my_trace", i);
|
||||
|
||||
//Notify to the other process that there is a message
|
||||
data->cond_empty.notify_one();
|
||||
|
||||
//Mark message buffer as full
|
||||
data->message_in = true;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include "doc_anonymous_condition_shared_data.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(open_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Obtain a pointer to the shared structure
|
||||
trace_queue * data = static_cast<trace_queue*>(addr);
|
||||
|
||||
//Print messages until the other process marks the end
|
||||
bool end_loop = false;
|
||||
do{
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
if(!data->message_in){
|
||||
data->cond_empty.wait(lock);
|
||||
}
|
||||
if(std::strcmp(data->items, "last message") == 0){
|
||||
end_loop = true;
|
||||
}
|
||||
else{
|
||||
//Print the message
|
||||
std::cout << data->items << std::endl;
|
||||
//Notify the other process that the buffer is empty
|
||||
data->message_in = false;
|
||||
data->cond_full.notify_one();
|
||||
}
|
||||
}
|
||||
while(!end_loop);
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <boost/interprocess/sync/named_mutex.hpp>
|
||||
#include <fstream>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
try{
|
||||
|
||||
//Open or create the named mutex
|
||||
named_mutex mutex(open_or_create, "cout_named_mutex");
|
||||
|
||||
std::ofstream file("file_name");
|
||||
|
||||
for(int i = 0; i < 10; ++i){
|
||||
|
||||
//Do some operations...
|
||||
|
||||
//Write to file atomically
|
||||
scoped_lock<named_mutex> lock(mutex);
|
||||
file << "Process name, ";
|
||||
file << "This is iteration #" << i;
|
||||
file << std::endl;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/offset_ptr.hpp>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
//Shared memory linked list node
|
||||
struct list_node
|
||||
{
|
||||
offset_ptr<list_node> next;
|
||||
int value;
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
//Destroy any previous shared memory with the name to be used.
|
||||
//Create an special shared memory from which we can
|
||||
//allocate buffers of raw memory.
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
managed_shared_memory segment(
|
||||
create_only,
|
||||
"MySharedMemory",//segment name
|
||||
65536); //segment size in bytes
|
||||
|
||||
//Create linked list with 10 nodes in shared memory
|
||||
offset_ptr<list_node> prev = 0, current, first;
|
||||
|
||||
int i;
|
||||
for(i = 0; i < 10; ++i, prev = current){
|
||||
current = static_cast<list_node*>(segment.allocate(sizeof(list_node)));
|
||||
current->value = i;
|
||||
current->next = 0;
|
||||
|
||||
if(!prev)
|
||||
first = current;
|
||||
else
|
||||
prev->next = current;
|
||||
}
|
||||
|
||||
//Communicate list to other processes
|
||||
//. . .
|
||||
//When done, destroy list
|
||||
for(current = first; current; /**/){
|
||||
prev = current;
|
||||
current = current->next;
|
||||
segment.deallocate(prev.get());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,43 +0,0 @@
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(create_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Set size
|
||||
shm.truncate(1000);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
std::size_t size = region.get_size();
|
||||
|
||||
//Write all the memory to 1
|
||||
std::memset(addr, 1, size);
|
||||
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
try{
|
||||
//Open already created shared memory object.
|
||||
shared_memory_object shm
|
||||
(open_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_only //read-write mode
|
||||
);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_only //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
std::size_t size = region.get_size();
|
||||
|
||||
//Check that memory was initialized to 1
|
||||
const char *mem = static_cast<char*>(addr);
|
||||
for(std::size_t i = 0; i < size; ++i){
|
||||
if(*mem++ != 1){
|
||||
std::cout << "Error checking memory!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Test successful!" << std::endl;
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << "Unexpected exception: " << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -35,12 +35,12 @@
|
||||
/* Code on paragraphs */
|
||||
p tt.computeroutput
|
||||
{
|
||||
font-size: 9pt;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
pre.synopsis
|
||||
{
|
||||
font-size: 90%;
|
||||
font-size: 10pt;
|
||||
margin: 1pc 4% 0pc 4%;
|
||||
padding: 0.5pc 0.5pc 0.5pc 0.5pc;
|
||||
}
|
||||
@@ -48,27 +48,19 @@
|
||||
.programlisting,
|
||||
.screen
|
||||
{
|
||||
font-size: 9pt;
|
||||
font-size: 10pt;
|
||||
display: block;
|
||||
margin: 1pc 4% 0pc 4%;
|
||||
padding: 0.5pc 0.5pc 0.5pc 0.5pc;
|
||||
}
|
||||
|
||||
/* Program listings in tables don't get borders */
|
||||
td .programlisting,
|
||||
td .screen
|
||||
{
|
||||
margin: 0pc 0pc 0pc 0pc;
|
||||
padding: 0pc 0pc 0pc 0pc;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Headings
|
||||
=============================================================================*/
|
||||
|
||||
h1, h2, h3, h4, h5, h6
|
||||
{
|
||||
text-align: left;
|
||||
text-align: left;
|
||||
margin: 1em 0em 0.5em 0em;
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -139,13 +131,13 @@
|
||||
font-size: 10pt;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
|
||||
/* Unordered lists */
|
||||
ul
|
||||
{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
||||
/* Ordered lists */
|
||||
ol
|
||||
{
|
||||
@@ -160,7 +152,7 @@
|
||||
{
|
||||
text-decoration: none; /* no underline */
|
||||
}
|
||||
|
||||
|
||||
a:hover
|
||||
{
|
||||
text-decoration: underline;
|
||||
@@ -174,13 +166,13 @@
|
||||
{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
.spirit-nav a
|
||||
{
|
||||
color: white;
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
|
||||
|
||||
.spirit-nav img
|
||||
{
|
||||
border-width: 0px;
|
||||
@@ -194,10 +186,19 @@
|
||||
{
|
||||
margin: 1pc 4% 0pc 4%;
|
||||
padding: 0.1pc 1pc 0.1pc 1pc;
|
||||
font-size: 80%;
|
||||
font-size: 10pt;
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
|
||||
.toc-main
|
||||
{
|
||||
width: 600;
|
||||
text-align: center;
|
||||
margin: 1pc 1pc 1pc 10%;
|
||||
padding: 2pc 1pc 3pc 1pc;
|
||||
line-height: 0.1;
|
||||
}
|
||||
|
||||
.boost-toc
|
||||
{
|
||||
float: right;
|
||||
@@ -215,7 +216,7 @@
|
||||
padding-right: 0.5em;
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
|
||||
|
||||
.informaltable table,
|
||||
.table table
|
||||
{
|
||||
@@ -223,20 +224,19 @@
|
||||
margin-left: 4%;
|
||||
margin-right: 4%;
|
||||
}
|
||||
|
||||
|
||||
div.informaltable table,
|
||||
div.table table
|
||||
{
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
|
||||
/* Table Cells */
|
||||
div.informaltable table tr td,
|
||||
div.table table tr td
|
||||
{
|
||||
padding: 0.5em;
|
||||
text-align: left;
|
||||
font-size: 9pt;
|
||||
}
|
||||
|
||||
div.informaltable table tr th,
|
||||
@@ -244,7 +244,7 @@
|
||||
{
|
||||
padding: 0.5em 0.5em 0.5em 0.5em;
|
||||
border: 1pt solid white;
|
||||
font-size: 80%;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
@@ -258,13 +258,13 @@
|
||||
div.warning,
|
||||
p.blurb
|
||||
{
|
||||
font-size: 9pt; /* A little bit smaller than the main text */
|
||||
font-size: 10pt;
|
||||
line-height: 1.2;
|
||||
display: block;
|
||||
margin: 1pc 4% 0pc 4%;
|
||||
padding: 0.5pc 0.5pc 0.5pc 0.5pc;
|
||||
}
|
||||
|
||||
|
||||
p.blurb img
|
||||
{
|
||||
padding: 1pt;
|
||||
@@ -274,8 +274,6 @@
|
||||
Variable Lists
|
||||
=============================================================================*/
|
||||
|
||||
/* Make the terms in definition lists bold */
|
||||
div.variablelist dl dt,
|
||||
span.term
|
||||
{
|
||||
font-weight: bold;
|
||||
@@ -288,28 +286,26 @@
|
||||
vertical-align: top;
|
||||
padding: 0em 2em 0em 0em;
|
||||
font-size: 10pt;
|
||||
margin: 0em 0em 0.5em 0em;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
div.variablelist table tbody tr td p
|
||||
{
|
||||
margin: 0em 0em 0.5em 0em;
|
||||
}
|
||||
|
||||
/* Make the terms in definition lists bold */
|
||||
div.variablelist dl dt
|
||||
{
|
||||
margin-bottom: 0.2em;
|
||||
font-weight: bold;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
div.variablelist dl dd
|
||||
{
|
||||
margin: 0em 0em 0.5em 2em;
|
||||
margin: 1em 0em 1em 2em;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
div.variablelist table tbody tr td p,
|
||||
div.variablelist dl dd p
|
||||
{
|
||||
margin: 0em 0em 0.5em 0em;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
Misc
|
||||
=============================================================================*/
|
||||
@@ -333,6 +329,7 @@
|
||||
/* Copyright, Legal Notice */
|
||||
div div.legalnotice p
|
||||
{
|
||||
font-size: 8pt;
|
||||
text-align: left
|
||||
}
|
||||
|
||||
@@ -342,15 +339,15 @@
|
||||
|
||||
@media screen
|
||||
{
|
||||
/* Links */
|
||||
/* Links */
|
||||
a
|
||||
{
|
||||
color: #005a9c;
|
||||
color: #0C7445;
|
||||
}
|
||||
|
||||
|
||||
a:visited
|
||||
{
|
||||
color: #9c5a9c;
|
||||
color: #663974;
|
||||
}
|
||||
|
||||
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a,
|
||||
@@ -360,8 +357,8 @@
|
||||
text-decoration: none; /* no underline */
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* Syntax Highlighting */
|
||||
|
||||
/* Syntax Highlighting */
|
||||
.keyword { color: #0000AA; }
|
||||
.identifier { color: #000000; }
|
||||
.special { color: #707070; }
|
||||
@@ -370,40 +367,40 @@
|
||||
.comment { color: #800000; }
|
||||
.string { color: teal; }
|
||||
.number { color: teal; }
|
||||
.white_bkd { background-color: #FFFFFF; }
|
||||
.dk_grey_bkd { background-color: #999999; }
|
||||
|
||||
/* Copyright, Legal Notice */
|
||||
.copyright
|
||||
.white_bkd { background-color: #E8FBE9; }
|
||||
.dk_grey_bkd { background-color: #A0DAAC; }
|
||||
|
||||
/* Copyright, Legal Notice */
|
||||
.copyright
|
||||
{
|
||||
color: #666666;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
|
||||
div div.legalnotice p
|
||||
{
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
/* Program listing */
|
||||
|
||||
/* Program listing */
|
||||
pre.synopsis
|
||||
{
|
||||
border: 1px solid #DCDCDC;
|
||||
border-bottom: 3px solid #9D9D9D;
|
||||
border-right: 3px solid #9D9D9D;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
|
||||
.programlisting,
|
||||
.screen
|
||||
{
|
||||
border: 1px solid #DCDCDC;
|
||||
border-bottom: 3px solid #9D9D9D;
|
||||
border-right: 3px solid #9D9D9D;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
td .programlisting,
|
||||
td .screen
|
||||
{
|
||||
border: 0px solid #DCDCDC;
|
||||
}
|
||||
|
||||
/* Blurbs */
|
||||
|
||||
/* Blurbs */
|
||||
div.note,
|
||||
div.tip,
|
||||
div.important,
|
||||
@@ -412,98 +409,128 @@
|
||||
p.blurb
|
||||
{
|
||||
border: 1px solid #DCDCDC;
|
||||
border-bottom: 3px solid #9D9D9D;
|
||||
border-right: 3px solid #9D9D9D;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
/* Table of contents */
|
||||
|
||||
/* Table of contents */
|
||||
.toc
|
||||
{
|
||||
border: 1px solid #DCDCDC;
|
||||
border-bottom: 3px solid #9D9D9D;
|
||||
border-right: 3px solid #9D9D9D;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
|
||||
/* Table of contents */
|
||||
.toc-main
|
||||
{
|
||||
border: 1px solid #DCDCDC;
|
||||
border-bottom: 3px solid #9D9D9D;
|
||||
border-right: 3px solid #9D9D9D;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
|
||||
/* Tables */
|
||||
div.informaltable table tr td,
|
||||
div.table table tr td
|
||||
{
|
||||
border: 1px solid #DCDCDC;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
|
||||
div.informaltable table tr th,
|
||||
div.table table tr th
|
||||
{
|
||||
background-color: #F0F0F0;
|
||||
background-color: #E3F9E4;
|
||||
border: 1px solid #DCDCDC;
|
||||
}
|
||||
|
||||
/* Misc */
|
||||
|
||||
/* Misc */
|
||||
span.highlight
|
||||
{
|
||||
color: #00A000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media print
|
||||
{
|
||||
/* Links */
|
||||
/* Links */
|
||||
a
|
||||
{
|
||||
color: black;
|
||||
}
|
||||
|
||||
|
||||
a:visited
|
||||
{
|
||||
color: black;
|
||||
}
|
||||
|
||||
|
||||
.spirit-nav
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Program listing */
|
||||
|
||||
/* Program listing */
|
||||
pre.synopsis
|
||||
{
|
||||
border: 1px solid gray;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
|
||||
.programlisting,
|
||||
.screen
|
||||
{
|
||||
border: 1px solid gray;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
td .programlisting,
|
||||
td .screen
|
||||
{
|
||||
border: 0px solid #DCDCDC;
|
||||
}
|
||||
|
||||
/* Table of contents */
|
||||
|
||||
/* Table of contents */
|
||||
.toc
|
||||
{
|
||||
border: 1px solid gray;
|
||||
border: 1px solid #DCDCDC;
|
||||
border-bottom: 3px solid #9D9D9D;
|
||||
border-right: 3px solid #9D9D9D;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
|
||||
/* Table of contents */
|
||||
.toc-main
|
||||
{
|
||||
border: 1px solid #DCDCDC;
|
||||
border-bottom: 3px solid #9D9D9D;
|
||||
border-right: 3px solid #9D9D9D;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
.informaltable table,
|
||||
.table table
|
||||
{
|
||||
border: 1px solid gray;
|
||||
border: 1px solid #DCDCDC;
|
||||
border-bottom: 3px solid #9D9D9D;
|
||||
border-right: 3px solid #9D9D9D;
|
||||
border-collapse: collapse;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
|
||||
/* Tables */
|
||||
div.informaltable table tr td,
|
||||
div.table table tr td
|
||||
{
|
||||
border: 1px solid gray;
|
||||
border: 1px solid #DCDCDC;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
|
||||
div.informaltable table tr th,
|
||||
div.table table tr th
|
||||
{
|
||||
border: 1px solid gray;
|
||||
border: 1px solid #DCDCDC;
|
||||
background-color: #FAFFFB;
|
||||
}
|
||||
|
||||
/* Misc */
|
||||
|
||||
/* Misc */
|
||||
span.highlight
|
||||
{
|
||||
font-weight: bold;
|
||||
|
||||
5049
doc/interprocess.qbk
5049
doc/interprocess.qbk
File diff suppressed because it is too large
Load Diff
@@ -1,96 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2004-2006. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
typedef std::pair<double, int> MyType;
|
||||
|
||||
//Named allocate capable shared mem allocator
|
||||
//Create shared memory
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
managed_shared_memory segment
|
||||
(create_only,
|
||||
"MySharedMemory",//segment name
|
||||
65536); //segment size in bytes
|
||||
|
||||
//Create an object of MyType initialized to {0, 0}
|
||||
segment.construct<MyType>
|
||||
("MyType instance") /*name of the object*/
|
||||
(0 /*ctor first argument*/,
|
||||
0 /*ctor second argument*/);
|
||||
|
||||
//Create an array of 10 elements of MyType initialized to {0, 0}
|
||||
segment.construct<MyType>
|
||||
("MyType array") /*name of the object*/
|
||||
[10] /*number of elements*/
|
||||
(0 /*ctor first argument*/,
|
||||
0 /*ctor second argument*/);
|
||||
|
||||
|
||||
//Let's simulate other process
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
typedef std::pair<double, int> MyType;
|
||||
|
||||
//Named allocate capable shared mem allocator
|
||||
//Create shared memory
|
||||
managed_shared_memory segment
|
||||
(open_only, "MySharedMemory"); //segment name
|
||||
|
||||
//Find the array and object
|
||||
std::pair<MyType*, std::size_t> res;
|
||||
res = segment.find<MyType> ("MyType array");
|
||||
|
||||
std::size_t array_len = res.second;
|
||||
//Length should be 1
|
||||
assert(array_len == 10);
|
||||
|
||||
//Find the array and the object
|
||||
res = segment.find<MyType> ("MyType instance");
|
||||
|
||||
std::size_t len = res.second;
|
||||
|
||||
//Length should be 1
|
||||
assert(len == 1);
|
||||
|
||||
//Change data
|
||||
// . . .
|
||||
|
||||
//We're done, delete array from memory
|
||||
segment.destroy<MyType>("MyType array");
|
||||
//We're done, delete object from memory
|
||||
segment.destroy<MyType>("MyType instance");
|
||||
}
|
||||
|
||||
MyType *anonymous = segment.construct<MyType>(anonymous_instance)
|
||||
[10] //number of elements
|
||||
(1, //ctor first argument
|
||||
1); //ctor second argument
|
||||
|
||||
segment.destroy_ptr(anonymous);
|
||||
|
||||
segment.construct<MyType>(unique_instance)
|
||||
[10] //number of elements
|
||||
(1, //ctor first argument
|
||||
1); //ctor second argument
|
||||
|
||||
std::pair<MyType *,std::size_t> ret = segment.find<MyType>(unique_instance);
|
||||
|
||||
segment.destroy<MyType>(unique_instance);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,38 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2004-2006. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_PRINTCONTAINER_HPP
|
||||
#define BOOST_PRINTCONTAINER_HPP
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
struct PrintValues : public std::unary_function<int, void>
|
||||
{
|
||||
void operator() (int value) const
|
||||
{
|
||||
std::cout << value << " ";
|
||||
}
|
||||
};
|
||||
|
||||
template<class Container>
|
||||
void PrintContents(const Container &cont, const char *contName)
|
||||
{
|
||||
std::cout<< "Printing contents of " << contName << std::endl;
|
||||
std::for_each(cont.begin(), cont.end(), PrintValues());
|
||||
std::cout<< std::endl << std::endl;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_PRINTCONTAINER_HPP
|
||||
@@ -1,38 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2004-2006. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_PRINTCONTAINER_HPP
|
||||
#define BOOST_PRINTCONTAINER_HPP
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
struct PrintValues : public std::unary_function<int, void>
|
||||
{
|
||||
void operator() (int value) const
|
||||
{
|
||||
std::cout << value << " ";
|
||||
}
|
||||
};
|
||||
|
||||
template<class Container>
|
||||
void PrintContents(const Container &cont, const char *contName)
|
||||
{
|
||||
std::cout<< "Printing contents of " << contName << std::endl;
|
||||
std::for_each(cont.begin(), cont.end(), PrintValues());
|
||||
std::cout<< std::endl << std::endl;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_PRINTCONTAINER_HPP
|
||||
@@ -1,81 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2004-2006. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/offset_ptr.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include "print_container.hpp"
|
||||
#include <algorithm>
|
||||
#include <boost/interprocess/sync/named_semaphore.hpp>
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_condition.hpp>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
//Shared memory attributes
|
||||
const int memsize = 65536;
|
||||
const char *const shMemName = "MySharedMemory";
|
||||
|
||||
//Create sems for synchronization
|
||||
named_semaphore semA(open_or_create, "processAsem", 0);
|
||||
named_semaphore semB(open_or_create, "processBsem", 0);
|
||||
|
||||
//Create shared memory
|
||||
managed_shared_memory segment(open_or_create, shMemName, memsize);
|
||||
|
||||
//STL compatible allocator object, uses allocate(), deallocate() functions
|
||||
typedef allocator<int, managed_shared_memory::segment_manager>
|
||||
shmem_allocator_int_t;
|
||||
|
||||
const int num_elements = 100;
|
||||
|
||||
//Type of shared memory vector
|
||||
typedef vector<int, shmem_allocator_int_t > MyVect;
|
||||
|
||||
const shmem_allocator_int_t &alloc_ref (segment.get_segment_manager());
|
||||
|
||||
//Creating the vector in shared memory
|
||||
std::cout << "Named New of ShmVect\n\n";
|
||||
MyVect *shmem_vect = segment.construct<MyVect> ("ShmVect")(alloc_ref);
|
||||
|
||||
offset_ptr<MyVect> shmptr_vect = 0;
|
||||
offset_ptr<MyVect> other_shmptr_vect = 0;
|
||||
|
||||
//Fill the vector
|
||||
std::cout << "Filling ShmVect\n\n";
|
||||
int i;
|
||||
for(i = 0; i < num_elements; ++i){
|
||||
shmem_vect->push_back(i);
|
||||
}
|
||||
|
||||
//Printing contents before waiting to second process
|
||||
PrintContents(*shmem_vect, "ShmVect");
|
||||
|
||||
//Wake up other process and sleeping until notified
|
||||
semB.post();
|
||||
std::cout << "Waking up processB and waiting sorting\n\n";
|
||||
semA.wait();
|
||||
|
||||
//Notification received, let's see the changes
|
||||
std::cout << "processB sorting complete\n\n";
|
||||
PrintContents(*shmem_vect, "ShmVect");
|
||||
|
||||
//Let's delete the vector from memory
|
||||
std::cout << "Deleting the vector with destroy\n\n";
|
||||
segment.destroy<MyVect> ("ShmVect");
|
||||
std::cout << "vector deleted\n\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,82 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2004-2006. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/offset_ptr.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/mem_algo/simple_seq_fit.hpp>
|
||||
#include "print_container.hpp"
|
||||
#include <boost/interprocess/sync/named_semaphore.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_condition.hpp>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
//Shared memory attributes
|
||||
const int memsize = 65536;
|
||||
const char *const shMemName = "MySharedMemory";
|
||||
const void *const map_addr = reinterpret_cast<const void*>(0x30000000);
|
||||
|
||||
//Create sems for synchronization
|
||||
named_semaphore semA(open_or_create, "processAsem", 0);
|
||||
named_semaphore semB(open_or_create, "processBsem", 0);
|
||||
|
||||
//Create shared memory
|
||||
fixed_managed_shared_memory segment(create_only, shMemName, memsize, map_addr);
|
||||
|
||||
//STL compatible allocator object, uses allocate(), deallocate() functions
|
||||
typedef allocator<int, fixed_managed_shared_memory::segment_manager>
|
||||
shmem_allocator_int_t;
|
||||
const int num_elements = 100;
|
||||
|
||||
//Type of shared memory vector
|
||||
typedef std::vector<int, shmem_allocator_int_t > MyVect;
|
||||
|
||||
const shmem_allocator_int_t alloc_inst (segment.get_segment_manager());
|
||||
|
||||
//Creating the vector in shared memory
|
||||
std::cout << "Named New of ShmVect\n\n";
|
||||
MyVect *shmem_vect = segment.construct<MyVect> ("ShmVect")(alloc_inst);
|
||||
|
||||
offset_ptr<MyVect> shmptr_vect = 0;
|
||||
offset_ptr<MyVect> other_shmptr_vect = 0;
|
||||
|
||||
//Fill the vector
|
||||
std::cout << "Filling ShmVect\n\n";
|
||||
int i;
|
||||
for(i = 0; i < num_elements; ++i){
|
||||
shmem_vect->push_back(i);
|
||||
}
|
||||
|
||||
//Printing contents before waiting to second process
|
||||
PrintContents(*shmem_vect, "ShmVect");
|
||||
|
||||
//Wake up other process and sleeping until notified
|
||||
semB.post();
|
||||
std::cout << "Waking up processB and waiting sorting\n\n";
|
||||
semA.wait();
|
||||
|
||||
//Notification received, let's see the changes
|
||||
std::cout << "processB sorting complete\n\n";
|
||||
PrintContents(*shmem_vect, "ShmVect");
|
||||
|
||||
//Let's delete the vector from memory
|
||||
std::cout << "Deleting the vector with destroy\n\n";
|
||||
segment.destroy<MyVect> ("ShmVect");
|
||||
std::cout << "vector deleted\n\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,71 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2004-2006. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/sync/named_semaphore.hpp>
|
||||
|
||||
#include "print_container.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
//Shared memory attributes
|
||||
const char *const shMemName = "MySharedMemory";
|
||||
|
||||
//Create sems for synchronization
|
||||
named_semaphore semA(open_or_create, "processAsem", 0);
|
||||
named_semaphore semB(open_or_create, "processBsem", 0);
|
||||
|
||||
//Wait until the shared memory is ready
|
||||
semB.wait();
|
||||
|
||||
//Create shared memory
|
||||
managed_shared_memory segment(open_or_create, shMemName, 65536);
|
||||
|
||||
//STL compatible allocator object, uses allocate(), deallocate() functions
|
||||
typedef allocator<int, managed_shared_memory::segment_manager>
|
||||
shmem_allocator_int_t;
|
||||
|
||||
//This is the shared memory vector type
|
||||
typedef vector<int, shmem_allocator_int_t > MyVect;
|
||||
|
||||
//Finding vector in shared memory and printing contents
|
||||
std::cout << "Connecting to object ShmVect\n\n";
|
||||
MyVect *shmem_vect = segment.find<MyVect>("ShmVect").first;
|
||||
PrintContents(*shmem_vect, "ShmVect");
|
||||
|
||||
//Reverse sorting the vector with std::sort
|
||||
std::cout << "Reverse sorting ShmVect\n\n";
|
||||
MyVect::reverse_iterator rbeg =
|
||||
shmem_vect->rbegin(), rend = shmem_vect->rend();
|
||||
std::sort(shmem_vect->rbegin(), shmem_vect->rend());
|
||||
std::sort(rbeg, rend);
|
||||
|
||||
//Printing values after sorting
|
||||
std::cout << "Sorting complete\n\n";
|
||||
PrintContents(*shmem_vect, "ShmVect");
|
||||
|
||||
//Waking up process A
|
||||
std::cout << "Waking up processA\n\n";
|
||||
semA.post();
|
||||
|
||||
//We're done, closing shared memory
|
||||
std::cout << "Closing shmem segment\n\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,69 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2004-2006. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/sync/named_semaphore.hpp>
|
||||
|
||||
#include "print_container.hpp"
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
//Shared memory attributes
|
||||
const char *const shMemName = "MySharedMemory";
|
||||
const void *const map_addr = reinterpret_cast<const void*>(0x30000000);
|
||||
|
||||
//Create sems for synchronization
|
||||
named_semaphore semA(open_or_create, "processAsem", 1);
|
||||
named_semaphore semB(open_or_create, "processBsem", 1);
|
||||
|
||||
//Wait until the shared memory is ready
|
||||
semB.wait();
|
||||
|
||||
//Create shared memory
|
||||
fixed_managed_shared_memory segment(open_only, shMemName, map_addr);
|
||||
|
||||
//STL compatible allocator object, uses allocate(), deallocate() functions
|
||||
typedef allocator<int,fixed_managed_shared_memory::segment_manager>
|
||||
shmem_allocator_int_t;
|
||||
|
||||
//This is the shared memory vector type
|
||||
typedef std::vector<int, shmem_allocator_int_t > MyVect;
|
||||
|
||||
//Finding vector in shared memory and printing contents
|
||||
std::cout << "Connecting to object ShmVect\n\n";
|
||||
MyVect *shmem_vect = segment.find<MyVect>("ShmVect").first;
|
||||
PrintContents(*shmem_vect, "ShmVect");
|
||||
|
||||
//Reverse sorting the vector with std::sort
|
||||
std::cout << "Reverse sorting ShmVect\n\n";
|
||||
std::sort(shmem_vect->rbegin(), shmem_vect->rend());
|
||||
|
||||
//Printing values after sorting
|
||||
std::cout << "Sorting complete\n\n";
|
||||
PrintContents(*shmem_vect, "ShmVect");
|
||||
|
||||
//Waking up process A
|
||||
std::cout << "Waking up processA\n\n";
|
||||
semA.post();
|
||||
|
||||
//We're done, closing shared memory
|
||||
std::cout << "Closing shmem segment\n\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Boost Interprocess Library Documentation test Jamfile
|
||||
# Boost Interprocess Library Example Jamfile
|
||||
|
||||
# (C) Copyright Ion Gaztañaga 2006.
|
||||
# (C) Copyright Ion Gaztañaga 2006.
|
||||
# Use, modification and distribution are subject to the
|
||||
# Boost Software License, Version 1.0. (See accompanying file
|
||||
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -21,14 +21,14 @@ rule test_all
|
||||
|
||||
for local fileb in [ glob *.cpp ]
|
||||
{
|
||||
all_rules += [ compile $(fileb)
|
||||
all_rules += [ link $(fileb) /boost/thread//boost_thread
|
||||
: # additional args
|
||||
: # test-files
|
||||
: # requirements
|
||||
] ;
|
||||
] ;
|
||||
}
|
||||
|
||||
return $(all_rules) ;
|
||||
}
|
||||
|
||||
test-suite interprocess_doc : [ test_all r ] ;
|
||||
test-suite interprocess_example : [ test_all r ] ;
|
||||
64
example/doc_adaptive_pool.cpp
Normal file
64
example/doc_adaptive_pool.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_adaptive_pool
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/allocators/adaptive_pool.hpp>
|
||||
#include <cassert>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
|
||||
try{
|
||||
//Create shared memory
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
|
||||
//Create a adaptive_pool that allocates ints from the managed segment
|
||||
//The number of chunks per segment is the default value
|
||||
typedef adaptive_pool<int, managed_shared_memory::segment_manager>
|
||||
adaptive_pool_t;
|
||||
adaptive_pool_t allocator_instance(segment.get_segment_manager());
|
||||
|
||||
//Create another adaptive_pool. Since the segment manager address
|
||||
//is the same, this adaptive_pool will be
|
||||
//attached to the same pool so "allocator_instance2" can deallocate
|
||||
//nodes allocated by "allocator_instance"
|
||||
adaptive_pool_t allocator_instance2(segment.get_segment_manager());
|
||||
|
||||
//Create another adaptive_pool using copy-constructor. This
|
||||
//adaptive_pool will also be attached to the same pool
|
||||
adaptive_pool_t allocator_instance3(allocator_instance2);
|
||||
|
||||
//All allocators are equal
|
||||
assert(allocator_instance == allocator_instance2);
|
||||
assert(allocator_instance2 == allocator_instance3);
|
||||
|
||||
//So memory allocated with one can be deallocated with another
|
||||
allocator_instance2.deallocate(allocator_instance.allocate(1), 1);
|
||||
allocator_instance3.deallocate(allocator_instance2.allocate(1), 1);
|
||||
|
||||
//The common pool will be destroyed here, since no allocator is
|
||||
//attached to the pool
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
43
example/doc_allocator.cpp
Normal file
43
example/doc_allocator.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_allocator
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <cassert>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
|
||||
//Create shared memory
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
|
||||
//Create an allocator that allocates ints from the managed segment
|
||||
allocator<int, managed_shared_memory::segment_manager>
|
||||
allocator_instance(segment.get_segment_manager());
|
||||
|
||||
//Copy constructed allocator is equal
|
||||
allocator<int, managed_shared_memory::segment_manager>
|
||||
allocator_instance2(allocator_instance);
|
||||
assert(allocator_instance2 == allocator_instance);
|
||||
|
||||
//Allocate and deallocate memory for 100 ints
|
||||
allocator_instance2.deallocate(allocator_instance.allocate(100), 100);
|
||||
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
77
example/doc_anonymous_conditionA.cpp
Normal file
77
example/doc_anonymous_conditionA.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_anonymous_conditionA
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include "doc_anonymous_condition_shared_data.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(create_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
try{
|
||||
//Set size
|
||||
shm.truncate(sizeof(trace_queue));
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
trace_queue * data = new (addr) trace_queue;
|
||||
|
||||
const int NumMsg = 100;
|
||||
|
||||
for(int i = 0; i < NumMsg; ++i){
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
if(data->message_in){
|
||||
data->cond_full.wait(lock);
|
||||
}
|
||||
if(i == (NumMsg-1))
|
||||
std::sprintf(data->items, "%s", "last message");
|
||||
else
|
||||
std::sprintf(data->items, "%s_%d", "my_trace", i);
|
||||
|
||||
//Notify to the other process that there is a message
|
||||
data->cond_empty.notify_one();
|
||||
|
||||
//Mark message buffer as full
|
||||
data->message_in = true;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
shared_memory_object::remove("shared_memory");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
72
example/doc_anonymous_conditionB.cpp
Normal file
72
example/doc_anonymous_conditionB.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_anonymous_conditionB
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include "doc_anonymous_condition_shared_data.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(open_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
try{
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Obtain a pointer to the shared structure
|
||||
trace_queue * data = static_cast<trace_queue*>(addr);
|
||||
|
||||
//Print messages until the other process marks the end
|
||||
bool end_loop = false;
|
||||
do{
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
if(!data->message_in){
|
||||
data->cond_empty.wait(lock);
|
||||
}
|
||||
if(std::strcmp(data->items, "last message") == 0){
|
||||
end_loop = true;
|
||||
}
|
||||
else{
|
||||
//Print the message
|
||||
std::cout << data->items << std::endl;
|
||||
//Notify the other process that the buffer is empty
|
||||
data->message_in = false;
|
||||
data->cond_full.notify_one();
|
||||
}
|
||||
}
|
||||
while(!end_loop);
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
shared_memory_object::remove("shared_memory");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
37
example/doc_anonymous_condition_shared_data.hpp
Normal file
37
example/doc_anonymous_condition_shared_data.hpp
Normal file
@@ -0,0 +1,37 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_anonymous_condition_shared_data
|
||||
#include <boost/interprocess/sync/interprocess_mutex.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_condition.hpp>
|
||||
|
||||
struct trace_queue
|
||||
{
|
||||
enum { LineSize = 100 };
|
||||
|
||||
trace_queue()
|
||||
: message_in(false)
|
||||
{}
|
||||
|
||||
//Mutex to protect access to the queue
|
||||
boost::interprocess::interprocess_mutex mutex;
|
||||
|
||||
//Condition to wait when the queue is empty
|
||||
boost::interprocess::interprocess_condition cond_empty;
|
||||
|
||||
//Condition to wait when the queue is full
|
||||
boost::interprocess::interprocess_condition cond_full;
|
||||
|
||||
//Items to fill
|
||||
char items[LineSize];
|
||||
|
||||
//Is there any message
|
||||
bool message_in;
|
||||
};
|
||||
//]
|
||||
75
example/doc_anonymous_mutexA.cpp
Normal file
75
example/doc_anonymous_mutexA.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_anonymous_mutexA
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include "doc_anonymous_mutex_shared_data.hpp"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(create_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Set size
|
||||
shm.truncate(sizeof(shared_memory_log));
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
shared_memory_log * data = new (addr) shared_memory_log;
|
||||
|
||||
//Write some logs
|
||||
for(int i = 0; i < shared_memory_log::NumItems; ++i){
|
||||
//Lock the mutex
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
std::sprintf(data->items[(data->current_line++) % shared_memory_log::NumItems]
|
||||
,"%s_%d", "process_a", i);
|
||||
if(i == (shared_memory_log::NumItems-1))
|
||||
data->end_a = true;
|
||||
//Mutex is released here
|
||||
}
|
||||
|
||||
//Wait until the other process ends
|
||||
while(1){
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
if(data->end_b)
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
shared_memory_object::remove("shared_memory");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
68
example/doc_anonymous_mutexB.cpp
Normal file
68
example/doc_anonymous_mutexB.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_anonymous_mutexB
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include "doc_anonymous_mutex_shared_data.hpp"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Open the shared memory object.
|
||||
shared_memory_object shm
|
||||
(open_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
shared_memory_log * data = static_cast<shared_memory_log*>(addr);
|
||||
|
||||
//Write some logs
|
||||
for(int i = 0; i < 100; ++i){
|
||||
//Lock the mutex
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
std::sprintf(data->items[(data->current_line++) % shared_memory_log::NumItems]
|
||||
,"%s_%d", "process_a", i);
|
||||
if(i == (shared_memory_log::NumItems-1))
|
||||
data->end_b = true;
|
||||
//Mutex is released here
|
||||
}
|
||||
|
||||
//Wait until the other process ends
|
||||
while(1){
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
if(data->end_a)
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
shared_memory_object::remove("shared_memory");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
shared_memory_object::remove("shared_memory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
33
example/doc_anonymous_mutex_shared_data.hpp
Normal file
33
example/doc_anonymous_mutex_shared_data.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_anonymous_mutex_shared_data
|
||||
#include <boost/interprocess/sync/interprocess_mutex.hpp>
|
||||
|
||||
struct shared_memory_log
|
||||
{
|
||||
enum { NumItems = 100 };
|
||||
enum { LineSize = 100 };
|
||||
|
||||
shared_memory_log()
|
||||
: current_line(0)
|
||||
, end_a(false)
|
||||
, end_b(false)
|
||||
{}
|
||||
|
||||
//Mutex to protect access to the queue
|
||||
boost::interprocess::interprocess_mutex mutex;
|
||||
|
||||
//Items to fill
|
||||
char items[NumItems][LineSize];
|
||||
int current_line;
|
||||
bool end_a;
|
||||
bool end_b;
|
||||
};
|
||||
//]
|
||||
68
example/doc_anonymous_semaphoreA.cpp
Normal file
68
example/doc_anonymous_semaphoreA.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_anonymous_semaphoreA
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <iostream>
|
||||
#include "doc_anonymous_semaphore_shared_data.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(create_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Set size
|
||||
shm.truncate(sizeof(shared_memory_buffer));
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
shared_memory_buffer * data = new (addr) shared_memory_buffer;
|
||||
|
||||
const int NumMsg = 100;
|
||||
|
||||
//Insert data in the array
|
||||
for(int i = 0; i < NumMsg; ++i){
|
||||
data->nempty.wait();
|
||||
data->mutex.wait();
|
||||
data->items[i % shared_memory_buffer::NumItems] = i;
|
||||
data->mutex.post();
|
||||
data->nstored.post();
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
shared_memory_object::remove("shared_memory");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
64
example/doc_anonymous_semaphoreB.cpp
Normal file
64
example/doc_anonymous_semaphoreB.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_anonymous_semaphoreB
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <iostream>
|
||||
#include "doc_anonymous_semaphore_shared_data.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(open_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Obtain the shared structure
|
||||
shared_memory_buffer * data = static_cast<shared_memory_buffer*>(addr);
|
||||
|
||||
const int NumMsg = 100;
|
||||
|
||||
int extracted_data [NumMsg];
|
||||
|
||||
//Extract the data
|
||||
for(int i = 0; i < NumMsg; ++i){
|
||||
data->nstored.wait();
|
||||
data->mutex.wait();
|
||||
extracted_data[i] = data->items[i % shared_memory_buffer::NumItems];
|
||||
data->mutex.post();
|
||||
data->nempty.post();
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
shared_memory_object::remove("shared_memory");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
28
example/doc_anonymous_semaphore_shared_data.hpp
Normal file
28
example/doc_anonymous_semaphore_shared_data.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_anonymous_semaphore_shared_data
|
||||
#include <boost/interprocess/sync/interprocess_semaphore.hpp>
|
||||
|
||||
struct shared_memory_buffer
|
||||
{
|
||||
enum { NumItems = 10 };
|
||||
|
||||
shared_memory_buffer()
|
||||
: mutex(1), nempty(NumItems), nstored(0)
|
||||
{}
|
||||
|
||||
//Semaphores to protect and synchronize access
|
||||
boost::interprocess::interprocess_semaphore
|
||||
mutex, nempty, nstored;
|
||||
|
||||
//Items to fill
|
||||
int items[NumItems];
|
||||
};
|
||||
//]
|
||||
77
example/doc_anonymous_upgradable_mutexA.cpp
Normal file
77
example/doc_anonymous_upgradable_mutexA.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_anonymous_upgradable_mutexA
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include "doc_upgradable_mutex_shared_data.hpp"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(create_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Set size
|
||||
shm.truncate(sizeof(shared_data));
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
shared_data * data = new (addr) shared_data;
|
||||
|
||||
//Write some logs
|
||||
for(int i = 0; i < shared_data::NumItems; ++i){
|
||||
//Lock the upgradable_mutex
|
||||
scoped_lock<interprocess_upgradable_mutex> lock(data->upgradable_mutex);
|
||||
std::sprintf(data->items[(data->current_line++) % shared_data::NumItems]
|
||||
,"%s_%d", "process_a", i);
|
||||
if(i == (shared_data::NumItems-1))
|
||||
data->end_a = true;
|
||||
//Mutex is released here
|
||||
}
|
||||
|
||||
//Wait until the other process ends
|
||||
while(1){
|
||||
scoped_lock<interprocess_upgradable_mutex> lock(data->upgradable_mutex);
|
||||
if(data->end_b)
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
shared_memory_object::remove("shared_memory");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
68
example/doc_anonymous_upgradable_mutexB.cpp
Normal file
68
example/doc_anonymous_upgradable_mutexB.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_anonymous_upgradable_mutexB
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include "doc_upgradable_mutex_shared_data.hpp"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Open the shared memory object.
|
||||
shared_memory_object shm
|
||||
(open_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
shared_data * data = static_cast<shared_data*>(addr);
|
||||
|
||||
//Write some logs
|
||||
for(int i = 0; i < 100; ++i){
|
||||
//Lock the upgradable_mutex
|
||||
scoped_lock<interprocess_upgradable_mutex> lock(data->upgradable_mutex);
|
||||
std::sprintf(data->items[(data->current_line++) % shared_data::NumItems]
|
||||
,"%s_%d", "process_a", i);
|
||||
if(i == (shared_data::NumItems-1))
|
||||
data->end_b = true;
|
||||
//Mutex is released here
|
||||
}
|
||||
|
||||
//Wait until the other process ends
|
||||
while(1){
|
||||
scoped_lock<interprocess_upgradable_mutex> lock(data->upgradable_mutex);
|
||||
if(data->end_a)
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
shared_memory_object::remove("shared_memory");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
shared_memory_object::remove("shared_memory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
@@ -1,20 +1,30 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_bufferstream
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/streams/bufferstream.hpp>
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/streams/bufferstream.hpp>
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
int main ()
|
||||
{
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
try{
|
||||
//Create shared memory
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
|
||||
//Fill data
|
||||
std::vector<int> data, data2;
|
||||
@@ -63,8 +73,14 @@
|
||||
//which means overflow attempt.
|
||||
assert(!mybufstream.good());
|
||||
assert(mybufstream.bad());
|
||||
segment.destroy_ptr(my_cstring);
|
||||
return 0;
|
||||
segment.destroy_ptr(my_cstring);
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
72
example/doc_cached_adaptive_pool.cpp
Normal file
72
example/doc_cached_adaptive_pool.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_cached_adaptive_pool
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/allocators/cached_adaptive_pool.hpp>
|
||||
#include <cassert>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
try{
|
||||
//Create shared memory
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
|
||||
//Create a cached_adaptive_pool that allocates ints from the managed segment
|
||||
//The number of chunks per segment is the default value
|
||||
typedef cached_adaptive_pool<int, managed_shared_memory::segment_manager>
|
||||
cached_adaptive_pool_t;
|
||||
cached_adaptive_pool_t allocator_instance(segment.get_segment_manager());
|
||||
|
||||
//The max cached nodes are configurable per instance
|
||||
allocator_instance.set_max_cached_nodes(3);
|
||||
|
||||
//Create another cached_adaptive_pool. Since the segment manager address
|
||||
//is the same, this cached_adaptive_pool will be
|
||||
//attached to the same pool so "allocator_instance2" can deallocate
|
||||
//nodes allocated by "allocator_instance"
|
||||
cached_adaptive_pool_t allocator_instance2(segment.get_segment_manager());
|
||||
|
||||
//The max cached nodes are configurable per instance
|
||||
allocator_instance2.set_max_cached_nodes(5);
|
||||
|
||||
//Create another cached_adaptive_pool using copy-constructor. This
|
||||
//cached_adaptive_pool will also be attached to the same pool
|
||||
cached_adaptive_pool_t allocator_instance3(allocator_instance2);
|
||||
|
||||
//We can clear the cache
|
||||
allocator_instance3.deallocate_cache();
|
||||
|
||||
//All allocators are equal
|
||||
assert(allocator_instance == allocator_instance2);
|
||||
assert(allocator_instance2 == allocator_instance3);
|
||||
|
||||
//So memory allocated with one can be deallocated with another
|
||||
allocator_instance2.deallocate(allocator_instance.allocate(1), 1);
|
||||
allocator_instance3.deallocate(allocator_instance2.allocate(1), 1);
|
||||
|
||||
//The common pool will be destroyed here, since no allocator is
|
||||
//attached to the pool
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
72
example/doc_cached_node_allocator.cpp
Normal file
72
example/doc_cached_node_allocator.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_cached_node_allocator
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/allocators/cached_node_allocator.hpp>
|
||||
#include <cassert>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
try{
|
||||
//Create shared memory
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
|
||||
//Create a cached_node_allocator that allocates ints from the managed segment
|
||||
//The number of chunks per segment is the default value
|
||||
typedef cached_node_allocator<int, managed_shared_memory::segment_manager>
|
||||
cached_node_allocator_t;
|
||||
cached_node_allocator_t allocator_instance(segment.get_segment_manager());
|
||||
|
||||
//The max cached nodes are configurable per instance
|
||||
allocator_instance.set_max_cached_nodes(3);
|
||||
|
||||
//Create another cached_node_allocator. Since the segment manager address
|
||||
//is the same, this cached_node_allocator will be
|
||||
//attached to the same pool so "allocator_instance2" can deallocate
|
||||
//nodes allocated by "allocator_instance"
|
||||
cached_node_allocator_t allocator_instance2(segment.get_segment_manager());
|
||||
|
||||
//The max cached nodes are configurable per instance
|
||||
allocator_instance2.set_max_cached_nodes(5);
|
||||
|
||||
//Create another cached_node_allocator using copy-constructor. This
|
||||
//cached_node_allocator will also be attached to the same pool
|
||||
cached_node_allocator_t allocator_instance3(allocator_instance2);
|
||||
|
||||
//We can clear the cache
|
||||
allocator_instance3.deallocate_cache();
|
||||
|
||||
//All allocators are equal
|
||||
assert(allocator_instance == allocator_instance2);
|
||||
assert(allocator_instance2 == allocator_instance3);
|
||||
|
||||
//So memory allocated with one can be deallocated with another
|
||||
allocator_instance2.deallocate(allocator_instance.allocate(1), 1);
|
||||
allocator_instance3.deallocate(allocator_instance2.allocate(1), 1);
|
||||
|
||||
//The common pool will be destroyed here, since no allocator is
|
||||
//attached to the pool
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,20 +1,28 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_cont
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/allocator/allocator.hpp>
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
try{
|
||||
//A managed shared memory where we can construct objects
|
||||
//associated with a c-string
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
|
||||
//Alias an STL-like allocator of ints that allocates ints from the segment
|
||||
typedef allocator<int, managed_shared_memory::segment_manager>
|
||||
@@ -34,8 +42,8 @@
|
||||
//from a range of iterators
|
||||
MyVector *myvector =
|
||||
segment.construct<MyVector>
|
||||
("MyVector")/*object name*/
|
||||
(begVal /*first ctor parameter*/,
|
||||
("MyVector")/*object name*/
|
||||
(begVal /*first ctor parameter*/,
|
||||
endVal /*second ctor parameter*/,
|
||||
alloc_inst /*third ctor parameter*/);
|
||||
|
||||
@@ -44,7 +52,13 @@
|
||||
// . . .
|
||||
//When done, destroy and delete vector from the segment
|
||||
segment.destroy<MyVector>("MyVector");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,13 +1,23 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_contA
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
try{
|
||||
//Shared memory front-end that is able to construct objects
|
||||
//associated with a c-string. Erase previous shared memory with the name
|
||||
//to be used and create the memory segment at the specified address and initialize resources
|
||||
@@ -29,7 +39,7 @@
|
||||
//Initialize shared memory STL-compatible allocator
|
||||
const ShmemAllocator alloc_inst (segment.get_segment_manager());
|
||||
|
||||
//Construct a shared memory vector vector
|
||||
//Construct a shared memory
|
||||
MyVector *myvector =
|
||||
segment.construct<MyVector>("MyVector") //object name
|
||||
(alloc_inst);//first ctor parameter
|
||||
@@ -38,8 +48,13 @@
|
||||
for(int i = 0; i < 100; ++i){
|
||||
myvector->push_back(i);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,15 +1,24 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_contB
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
try{
|
||||
//An special shared memory where we can
|
||||
//construct objects associated with a name.
|
||||
//Connect to the already created shared memory segment
|
||||
@@ -36,7 +45,13 @@
|
||||
|
||||
//When done, destroy the vector from the segment
|
||||
segment.destroy<MyVector>("MyVector");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
60
example/doc_file_mapping.cpp
Normal file
60
example/doc_file_mapping.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_file_mapping
|
||||
#include <boost/interprocess/file_mapping.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
#include <cstddef>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
try{
|
||||
//Create a file
|
||||
std::filebuf fbuf;
|
||||
fbuf.open("file.bin", std::ios_base::in | std::ios_base::out
|
||||
| std::ios_base::trunc | std::ios_base::binary);
|
||||
|
||||
//Set the size
|
||||
fbuf.pubseekoff(9999, std::ios_base::beg);
|
||||
fbuf.sputc(0);
|
||||
fbuf.close();
|
||||
|
||||
//Create a file mapping.
|
||||
file_mapping m_file("file.bin", read_write);
|
||||
|
||||
//Map the whole file in this process
|
||||
mapped_region region
|
||||
(m_file //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
if(region.get_size() != 10000)
|
||||
return 1;
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
std::size_t size = region.get_size();
|
||||
|
||||
//Write all the memory to 1
|
||||
std::memset(addr, 1, size);
|
||||
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::remove("file.bin");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::remove("file.bin");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
71
example/doc_file_mapping2.cpp
Normal file
71
example/doc_file_mapping2.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_file_mapping2
|
||||
#include <boost/interprocess/file_mapping.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
try{
|
||||
//Open the file mapping
|
||||
file_mapping m_file ("file.bin", read_only);
|
||||
|
||||
//Map the whole file in this process
|
||||
mapped_region region
|
||||
(m_file //What to map
|
||||
,read_only //Map it as read-only
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
std::size_t size = region.get_size();
|
||||
|
||||
//Check that memory was initialized to 1
|
||||
const char *mem = static_cast<char*>(addr);
|
||||
for(std::size_t i = 0; i < size; ++i){
|
||||
if(*mem++ != 1){
|
||||
std::cout << "Error checking memory!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
//Now test it reading the file
|
||||
std::filebuf fbuf;
|
||||
fbuf.open("file.bin", std::ios_base::in | std::ios_base::binary);
|
||||
|
||||
//Read it to memory
|
||||
std::vector<char> vect(region.get_size(), 0);
|
||||
fbuf.sgetn(&vect[0], std::streamsize(vect.size()));
|
||||
|
||||
//Check that memory was initialized to 1
|
||||
mem = static_cast<char*>(&vect[0]);
|
||||
for(std::size_t i = 0; i < size; ++i){
|
||||
if(*mem++ != 1){
|
||||
std::cout << "Error checking memory!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Test successful!" << std::endl;
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::remove("file.bin");
|
||||
std::cout << "Unexpected exception: " << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::remove("file.bin");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
111
example/doc_intrusive.cpp
Normal file
111
example/doc_intrusive.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_intrusive
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/smart_ptr/intrusive_ptr.hpp>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
namespace N {
|
||||
|
||||
//A class that has an internal reference count
|
||||
class reference_counted_class
|
||||
{
|
||||
private:
|
||||
//Non-copyable
|
||||
reference_counted_class(const reference_counted_class &);
|
||||
//Non-assignable
|
||||
reference_counted_class & operator=(const reference_counted_class &);
|
||||
//A typedef to save typing
|
||||
typedef managed_shared_memory::segment_manager segment_manager;
|
||||
//This is the reference count
|
||||
unsigned int m_use_count;
|
||||
//The segment manager allows deletion from shared memory segment
|
||||
offset_ptr<segment_manager> mp_segment_manager;
|
||||
|
||||
public:
|
||||
//Constructor
|
||||
reference_counted_class(segment_manager *s_mngr)
|
||||
: m_use_count(0), mp_segment_manager(s_mngr){}
|
||||
//Destructor
|
||||
~reference_counted_class(){}
|
||||
|
||||
public:
|
||||
//Returns the reference count
|
||||
unsigned int use_count() const
|
||||
{ return m_use_count; }
|
||||
|
||||
//Adds a reference
|
||||
inline friend void intrusive_ptr_add_ref(reference_counted_class * p)
|
||||
{ ++p->m_use_count; }
|
||||
|
||||
//Releases a reference
|
||||
inline friend void intrusive_ptr_release(reference_counted_class * p)
|
||||
{ if(--p->m_use_count == 0) p->mp_segment_manager->destroy_ptr(p); }
|
||||
};
|
||||
|
||||
} //namespace N {
|
||||
|
||||
//A class that has an intrusive pointer to reference_counted_class
|
||||
class intrusive_ptr_owner
|
||||
{
|
||||
typedef intrusive_ptr<N::reference_counted_class,
|
||||
offset_ptr<void> > intrusive_ptr_t;
|
||||
intrusive_ptr_t m_intrusive_ptr;
|
||||
|
||||
public:
|
||||
//Takes a pointer to the reference counted class
|
||||
intrusive_ptr_owner(N::reference_counted_class *ptr)
|
||||
: m_intrusive_ptr(ptr){}
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
shared_memory_object::remove("my_shmem");
|
||||
|
||||
try{
|
||||
//Create shared memory
|
||||
managed_shared_memory shmem(create_only, "my_shmem", 10000);
|
||||
|
||||
//Create the unique reference counted object in shared memory
|
||||
N::reference_counted_class *ref_counted =
|
||||
shmem.construct<N::reference_counted_class>
|
||||
("ref_counted")(shmem.get_segment_manager());
|
||||
|
||||
//Create an array of ten intrusive pointer owners in shared memory
|
||||
intrusive_ptr_owner *intrusive_owner_array =
|
||||
shmem.construct<intrusive_ptr_owner>
|
||||
(anonymous_instance)[10](ref_counted);
|
||||
|
||||
//Now test that reference count is ten
|
||||
if(ref_counted->use_count() != 10)
|
||||
return 1;
|
||||
|
||||
//Now destroy the array of intrusive pointer owners
|
||||
//This should destroy every intrusive_ptr and because of
|
||||
//that reference_counted_class will be destroyed
|
||||
shmem.destroy_ptr(intrusive_owner_array);
|
||||
|
||||
//Now the reference counted object should have been destroyed
|
||||
if(shmem.find<intrusive_ptr_owner>("ref_counted").first)
|
||||
return 1;
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("my_shmem");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("my_shmem");
|
||||
//Success!
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
55
example/doc_ipc_messageA.cpp
Normal file
55
example/doc_ipc_messageA.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_ipc_messageA
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
|
||||
//An special shared memory from which we are
|
||||
//able to allocate raw memory buffers.
|
||||
//First remove any old shared memory of the same name, create
|
||||
//the shared memory segment and initialize needed resources
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
try{
|
||||
managed_shared_memory segment
|
||||
(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536); //segment size in bytes
|
||||
|
||||
//Allocate a portion of the segment
|
||||
void * shptr = segment.allocate(1024/*bytes to allocate*/);
|
||||
|
||||
//An handle from the base address can identify any byte of the shared
|
||||
//memory segment even if it is mapped in different base addresses
|
||||
managed_shared_memory::handle_t handle = segment.get_handle_from_address(shptr);
|
||||
(void)handle;
|
||||
// Copy message to buffer
|
||||
// . . .
|
||||
// Send handle to other process
|
||||
// . . .
|
||||
// Wait response from other process
|
||||
// . . .
|
||||
|
||||
//Deallocate the portion previously allocated
|
||||
segment.deallocate(shptr);
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,65 +1,47 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2004. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
//[doc_ipc_messageB
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
|
||||
//Create managed shared memory
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory",//segment name
|
||||
65536); //segment size in bytes;
|
||||
|
||||
//Allocate a portion of the segment
|
||||
void * shptr = segment.allocate(1024);
|
||||
managed_shared_memory::handle_t handle = segment.get_handle_from_address(shptr);
|
||||
(void)handle;
|
||||
|
||||
// Copy message to buffer
|
||||
// . . .
|
||||
// Send handle to other process
|
||||
// . . .
|
||||
// Wait response from other process
|
||||
// . . .
|
||||
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
|
||||
//Named allocate capable shared memory allocator
|
||||
managed_shared_memory segment(open_only, "MySharedMemory");
|
||||
try{
|
||||
//An special shared memory from which we are
|
||||
//able to allocate raw memory buffers.
|
||||
//Connect to the already created shared memory segment
|
||||
//and initialize needed resources
|
||||
managed_shared_memory segment(open_only, "MySharedMemory"); //segment name
|
||||
|
||||
//An handle from the base address can identify any byte of the shared
|
||||
//memory segment even if it is mapped in different base addresses
|
||||
managed_shared_memory::handle_t handle = 0;
|
||||
(void)handle;
|
||||
|
||||
//Wait handle msg from other process and put it in
|
||||
//Wait handle msg from the other process and put it in
|
||||
//"handle" local variable
|
||||
|
||||
//Get buffer local address from handle
|
||||
void *msg = segment.get_address_from_handle(handle);
|
||||
(void)msg;
|
||||
|
||||
//Do anything with msg
|
||||
//. . .
|
||||
//Send ack to sender process
|
||||
}
|
||||
|
||||
segment.deallocate(shptr);
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
67
example/doc_managed_aligned_allocation.cpp
Normal file
67
example/doc_managed_aligned_allocation.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_managed_aligned_allocation
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
|
||||
//Managed memory segment that allocates portions of a shared memory
|
||||
//segment with the default management algorithm
|
||||
shared_memory_object::remove("MyManagedShm");
|
||||
|
||||
try{
|
||||
managed_shared_memory managed_shm(create_only, "MyManagedShm", 65536);
|
||||
|
||||
const std::size_t Alignment = 128;
|
||||
|
||||
//Allocate 100 bytes aligned to Alignment from segment, throwing version
|
||||
void *ptr = managed_shm.allocate_aligned(100, Alignment);
|
||||
|
||||
//Check alignment
|
||||
assert(((char*)ptr-(char*)0) % Alignment == 0);
|
||||
|
||||
//Deallocate it
|
||||
managed_shm.deallocate(ptr);
|
||||
|
||||
//Non throwing version
|
||||
ptr = managed_shm.allocate_aligned(100, Alignment, std::nothrow);
|
||||
|
||||
//Check alignment
|
||||
assert(((char*)ptr-(char*)0) % Alignment == 0);
|
||||
|
||||
//Deallocate it
|
||||
managed_shm.deallocate(ptr);
|
||||
|
||||
//If we want to efficiently allocate aligned blocks of memory
|
||||
//use managed_shared_memory::PayloadPerAllocation value
|
||||
assert(Alignment > managed_shared_memory::PayloadPerAllocation);
|
||||
|
||||
//This allocation will maximize the size of the aligned memory
|
||||
//and will increase the possibility of finding more aligned memory
|
||||
ptr = managed_shm.allocate_aligned
|
||||
(Alignment - managed_shared_memory::PayloadPerAllocation, Alignment);
|
||||
|
||||
//Check alignment
|
||||
assert(((char*)ptr-(char*)0) % Alignment == 0);
|
||||
|
||||
//Deallocate it
|
||||
managed_shm.deallocate(ptr);
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MyManagedShm");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MyManagedShm");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
66
example/doc_managed_external_buffer.cpp
Normal file
66
example/doc_managed_external_buffer.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_managed_external_buffer
|
||||
#include <boost/interprocess/managed_external_buffer.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <boost/interprocess/containers/list.hpp>
|
||||
#include <cstring>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
|
||||
//Create the static memory who will store all objects
|
||||
const int memsize = 65536;
|
||||
static char static_buffer [memsize];
|
||||
|
||||
//This managed memory will construct objects associated with
|
||||
//a wide string in the static buffer
|
||||
wmanaged_external_buffer objects_in_static_memory
|
||||
(create_only, static_buffer, memsize);
|
||||
|
||||
//We optimize resources to create 100 named objects in the static buffer
|
||||
objects_in_static_memory.reserve_named_objects(100);
|
||||
|
||||
//Alias a integer node allocator type
|
||||
//This allocator will allocate memory inside the static buffer
|
||||
typedef allocator<int, wmanaged_external_buffer::segment_manager>
|
||||
allocator_t;
|
||||
|
||||
//Alias a STL compatible list to be constructed in the static buffer
|
||||
typedef list<int, allocator_t> MyBufferList;
|
||||
|
||||
//The list must be initialized with the allocator
|
||||
//All objects created with objects_in_static_memory will
|
||||
//be stored in the static_buffer!
|
||||
MyBufferList *list = objects_in_static_memory.construct<MyBufferList>(L"MyList")
|
||||
(objects_in_static_memory.get_segment_manager());
|
||||
|
||||
//Since the allocation algorithm from wmanaged_external_buffer uses relative
|
||||
//pointers and all the pointers constructed int the static memory point
|
||||
//to objects in the same segment, we can create another static buffer
|
||||
//from the first one and duplicate all the data.
|
||||
static char static_buffer2 [memsize];
|
||||
std::memcpy(static_buffer2, static_buffer, memsize);
|
||||
|
||||
//Now open the duplicated managed memory passing the memory as argument
|
||||
wmanaged_external_buffer objects_in_static_memory2
|
||||
(open_only, static_buffer2, memsize);
|
||||
|
||||
//Check that "MyList" has been duplicated in the second buffer
|
||||
if(!objects_in_static_memory2.find<MyBufferList>(L"MyList").first)
|
||||
return 1;
|
||||
|
||||
//Destroy the lists from the static buffers
|
||||
objects_in_static_memory.destroy<MyBufferList>(L"MyList");
|
||||
objects_in_static_memory2.destroy<MyBufferList>(L"MyList");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
75
example/doc_managed_heap_memory.cpp
Normal file
75
example/doc_managed_heap_memory.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_managed_heap_memory
|
||||
#include <boost/interprocess/containers/list.hpp>
|
||||
#include <boost/interprocess/managed_heap_memory.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
typedef list<int, allocator<int, managed_heap_memory::segment_manager> >
|
||||
MyList;
|
||||
|
||||
int main ()
|
||||
{
|
||||
//We will create a buffer of 1000 bytes to store a list
|
||||
managed_heap_memory heap_memory(1000);
|
||||
|
||||
MyList * mylist = heap_memory.construct<MyList>("MyList")
|
||||
(heap_memory.get_segment_manager());
|
||||
|
||||
//Obtain handle, that identifies the list in the buffer
|
||||
managed_heap_memory::handle_t list_handle = heap_memory.get_handle_from_address(mylist);
|
||||
|
||||
//Fill list until there is no more memory in the buffer
|
||||
try{
|
||||
while(1) {
|
||||
mylist->insert(mylist->begin(), 0);
|
||||
}
|
||||
}
|
||||
catch(const bad_alloc &){
|
||||
//memory is full
|
||||
}
|
||||
//Let's obtain the size of the list
|
||||
std::size_t old_size = mylist->size();
|
||||
|
||||
//To make the list bigger, let's increase the heap buffer
|
||||
//in 1000 bytes more.
|
||||
heap_memory.grow(1000);
|
||||
|
||||
//If memory has been reallocated, the old pointer is invalid, so
|
||||
//use previously obtained handle to find the new pointer.
|
||||
mylist = static_cast<MyList *>
|
||||
(heap_memory.get_address_from_handle(list_handle));
|
||||
|
||||
//Fill list until there is no more memory in the buffer
|
||||
try{
|
||||
while(1) {
|
||||
mylist->insert(mylist->begin(), 0);
|
||||
}
|
||||
}
|
||||
catch(const bad_alloc &){
|
||||
//memory is full
|
||||
}
|
||||
|
||||
//Let's obtain the new size of the list
|
||||
std::size_t new_size = mylist->size();
|
||||
|
||||
assert(new_size > old_size);
|
||||
|
||||
//Destroy list
|
||||
heap_memory.destroy_ptr(mylist);
|
||||
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,21 +1,31 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/containers/list.hpp>
|
||||
#include <boost/interprocess/managed_mapped_file.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <boost/interprocess/containers/list.hpp>
|
||||
#include <boost/interprocess/managed_mapped_file.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
typedef list<int, allocator<int, managed_mapped_file::segment_manager> >
|
||||
MyList;
|
||||
using namespace boost::interprocess;
|
||||
typedef list<int, allocator<int, managed_mapped_file::segment_manager> >
|
||||
MyList;
|
||||
|
||||
int main ()
|
||||
{
|
||||
const char *FileName = "file_mapping";
|
||||
const std::size_t FileSize = 1000;
|
||||
std::remove(FileName);
|
||||
int main ()
|
||||
{
|
||||
const char *FileName = "file_mapping";
|
||||
const std::size_t FileSize = 1000;
|
||||
std::remove(FileName);
|
||||
try{
|
||||
managed_mapped_file mfile_memory(create_only, FileName, FileSize);
|
||||
MyList * mylist = mfile_memory.construct<MyList>("MyList")
|
||||
(mfile_memory.get_segment_manager());
|
||||
@@ -37,7 +47,7 @@
|
||||
|
||||
//To make the list bigger, let's increase the mapped file
|
||||
//in FileSize bytes more.
|
||||
// mfile_memory.grow(FileSize);
|
||||
//mfile_memory.grow(FileSize);
|
||||
|
||||
//If mapping address has changed, the old pointer is invalid,
|
||||
//so use previously obtained handle to find the new pointer.
|
||||
@@ -61,8 +71,13 @@
|
||||
|
||||
//Destroy list
|
||||
mfile_memory.destroy_ptr(mylist);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch(...){
|
||||
std::remove(FileName);
|
||||
throw;
|
||||
}
|
||||
std::remove(FileName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
42
example/doc_managed_raw_allocation.cpp
Normal file
42
example/doc_managed_raw_allocation.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_managed_raw_allocation
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
|
||||
//Managed memory segment that allocates portions of a shared memory
|
||||
//segment with the default management algorithm
|
||||
shared_memory_object::remove("MyManagedShm");
|
||||
try{
|
||||
managed_shared_memory managed_shm(create_only, "MyManagedShm", 65536);
|
||||
|
||||
//Allocate 100 bytes of memory from segment, throwing version
|
||||
void *ptr = managed_shm.allocate(100);
|
||||
|
||||
//Deallocate it
|
||||
managed_shm.deallocate(ptr);
|
||||
|
||||
//Non throwing version
|
||||
ptr = managed_shm.allocate(100, std::nothrow);
|
||||
|
||||
//Deallocate it
|
||||
managed_shm.deallocate(ptr);
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MyManagedShm");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MyManagedShm");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
75
example/doc_map.cpp
Normal file
75
example/doc_map.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_map
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/containers/map.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
//Shared memory front-end that is able to construct objects
|
||||
//associated with a c-string. Erase previous shared memory with the name
|
||||
//to be used and create the memory segment at the specified address and initialize resources
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
|
||||
try{
|
||||
managed_shared_memory segment
|
||||
(create_only
|
||||
,"MySharedMemory" //segment name
|
||||
,65536); //segment size in bytes
|
||||
|
||||
//Note that map<Key, MappedType>'s value_type is std::pair<const Key, MappedType>,
|
||||
//so the allocator must allocate that pair.
|
||||
typedef int KeyType;
|
||||
typedef float MappedType;
|
||||
typedef std::pair<int, float> ValueType;
|
||||
|
||||
//Alias an STL compatible allocator of for the map.
|
||||
//This allocator will allow to place containers
|
||||
//in managed shared memory segments
|
||||
typedef allocator<ValueType, managed_shared_memory::segment_manager>
|
||||
ShmemAllocator;
|
||||
|
||||
//Alias a map of ints that uses the previous STL-like allocator.
|
||||
//Note that the third parameter argument is the ordering function
|
||||
//of the map, just like with std::map, used to compare the keys.
|
||||
typedef map<KeyType, MappedType, std::less<KeyType>, ShmemAllocator> MyMap;
|
||||
|
||||
//Initialize the shared memory STL-compatible allocator
|
||||
ShmemAllocator alloc_inst (segment.get_segment_manager());
|
||||
|
||||
//Construct a shared memory map.
|
||||
//Note that the first parameter is the comparison function,
|
||||
//and the second one the allocator.
|
||||
//This the same signature as std::map's constructor taking an allocator
|
||||
MyMap *mymap =
|
||||
segment.construct<MyMap>("MyMap") //object name
|
||||
(std::less<int>() //first ctor parameter
|
||||
,alloc_inst); //second ctor parameter
|
||||
|
||||
//Insert data in the map
|
||||
for(int i = 0; i < 100; ++i){
|
||||
mymap->insert(std::pair<int, float>(i, (float)i));
|
||||
}
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
45
example/doc_message_queueA.cpp
Normal file
45
example/doc_message_queueA.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_message_queueA
|
||||
#include <boost/interprocess/ipc/message_queue.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous message queue
|
||||
message_queue::remove("message_queue");
|
||||
|
||||
//Create a message_queue.
|
||||
message_queue mq
|
||||
(create_only //only create
|
||||
,"message_queue" //name
|
||||
,100 //max message number
|
||||
,sizeof(int) //max message size
|
||||
);
|
||||
|
||||
//Send 100 numbers
|
||||
for(int i = 0; i < 100; ++i){
|
||||
mq.send(&i, sizeof(i), 0);
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
message_queue::remove("message_queue");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
message_queue::remove("message_queue");
|
||||
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
45
example/doc_message_queueB.cpp
Normal file
45
example/doc_message_queueB.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_message_queueB
|
||||
#include <boost/interprocess/ipc/message_queue.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Open a message queue.
|
||||
message_queue mq
|
||||
(open_only //only create
|
||||
,"message_queue" //name
|
||||
);
|
||||
|
||||
unsigned int priority;
|
||||
unsigned int recvd_size;
|
||||
|
||||
//Receive 100 numbers
|
||||
for(int i = 0; i < 100; ++i){
|
||||
int number;
|
||||
mq.receive(&number, sizeof(number), recvd_size, priority);
|
||||
if(number != i || recvd_size != sizeof(number))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
message_queue::remove("message_queue");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
message_queue::remove("message_queue");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
@@ -1,26 +1,36 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_move_containers
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/containers/string.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <cassert>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/containers/string.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <cassert>
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
//Typedefs
|
||||
typedef managed_shared_memory::segment_manager SegmentManager;
|
||||
typedef allocator<char, SegmentManager> CharAllocator;
|
||||
typedef basic_string<char, std::char_traits<char>
|
||||
,CharAllocator> MyShmString;
|
||||
typedef allocator<MyShmString, SegmentManager> StringAllocator;
|
||||
typedef vector<MyShmString, StringAllocator> MyShmStringVector;
|
||||
|
||||
//Typedefs
|
||||
typedef managed_shared_memory::segment_manager SegmentManager;
|
||||
typedef allocator<char, SegmentManager> CharAllocator;
|
||||
typedef basic_string<char, std::char_traits<char>
|
||||
,CharAllocator> MyShmString;
|
||||
typedef allocator<MyShmString, SegmentManager> StringAllocator;
|
||||
typedef vector<MyShmString, StringAllocator> MyShmStringVector;
|
||||
|
||||
//Remove old shared memory and create new one
|
||||
shared_memory_object::remove("myshm");
|
||||
//Remove old shared memory and create new one
|
||||
shared_memory_object::remove("myshm");
|
||||
try{
|
||||
managed_shared_memory shm(create_only, "myshm", 10000);
|
||||
|
||||
//Create allocators
|
||||
@@ -63,7 +73,13 @@
|
||||
|
||||
//Destroy vector. This will free all strings that the vector contains
|
||||
shm.destroy_ptr(myshmvector);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
catch(...){
|
||||
shared_memory_object::remove("myshmvector");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("myshmvector");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
50
example/doc_named_allocA.cpp
Normal file
50
example/doc_named_allocA.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_named_allocA
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <utility>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
typedef std::pair<double, int> MyType;
|
||||
|
||||
try{
|
||||
//An special shared memory where we can
|
||||
//construct objects associated with a name.
|
||||
//First remove any old shared memory of the same name, create
|
||||
//the shared memory segment and initialize needed resources
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
managed_shared_memory segment
|
||||
//create segment name segment size
|
||||
(create_only, "MySharedMemory", 65536);
|
||||
|
||||
//Create an object of MyType initialized to {0.0, 0}
|
||||
MyType *instance = segment.construct<MyType>
|
||||
("MyType instance") //name of the object
|
||||
(0.0, 0); //ctor second argument
|
||||
|
||||
//Create an array of 10 elements of MyType initialized to {0.0, 0}
|
||||
MyType *array = segment.construct<MyType>
|
||||
("MyType array") //name of the object
|
||||
[10] //number of elements
|
||||
(0.0, 0); //ctor second argument
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
63
example/doc_named_allocB.cpp
Normal file
63
example/doc_named_allocB.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_named_allocB
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
#include <assert.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
typedef std::pair<double, int> MyType;
|
||||
|
||||
try{
|
||||
//An special shared memory where we can
|
||||
//construct objects associated with a name.
|
||||
//Connect to the already created shared memory segment
|
||||
//and initialize needed resources
|
||||
managed_shared_memory segment(open_only, "MySharedMemory");
|
||||
|
||||
//Find the array and object
|
||||
std::pair<MyType*, std::size_t> res;
|
||||
res = segment.find<MyType> ("MyType array");
|
||||
|
||||
std::size_t array_len = res.second;
|
||||
//Length should be 10
|
||||
assert(array_len == 10);
|
||||
|
||||
//Find the array and the object
|
||||
res = segment.find<MyType> ("MyType instance");
|
||||
|
||||
std::size_t len = res.second;
|
||||
|
||||
//Length should be 1
|
||||
assert(len == 1);
|
||||
|
||||
//Use data
|
||||
// . . .
|
||||
|
||||
//We're done, delete array from memory
|
||||
segment.destroy<MyType>("MyType array");
|
||||
|
||||
//We're done, delete object from memory
|
||||
segment.destroy<MyType>("MyType instance");
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
76
example/doc_named_conditionA.cpp
Normal file
76
example/doc_named_conditionA.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include "doc_anonymous_condition_shared_data.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(create_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Set size
|
||||
shm.truncate(sizeof(trace_queue));
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Construct the shared structure in memory
|
||||
trace_queue * data = new (addr) trace_queue;
|
||||
|
||||
const int NumMsg = 100;
|
||||
|
||||
for(int i = 0; i < NumMsg; ++i){
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
if(data->message_in){
|
||||
data->cond_full.wait(lock);
|
||||
}
|
||||
if(i == (NumMsg-1))
|
||||
std::sprintf(data->items, "%s", "last message");
|
||||
else
|
||||
std::sprintf(data->items, "%s_%d", "my_trace", i);
|
||||
|
||||
//Notify to the other process that there is a message
|
||||
data->cond_empty.notify_one();
|
||||
|
||||
//Mark message buffer as full
|
||||
data->message_in = true;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
shared_memory_object::remove("shared_memory");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
73
example/doc_named_conditionB.cpp
Normal file
73
example/doc_named_conditionB.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include "doc_anonymous_condition_shared_data.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm
|
||||
(open_only //only create
|
||||
,"shared_memory" //name
|
||||
,read_write //read-write mode
|
||||
);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region
|
||||
(shm //What to map
|
||||
,read_write //Map it as read-write
|
||||
);
|
||||
|
||||
//Get the address of the mapped region
|
||||
void * addr = region.get_address();
|
||||
|
||||
//Obtain a pointer to the shared structure
|
||||
trace_queue * data = static_cast<trace_queue*>(addr);
|
||||
|
||||
//Print messages until the other process marks the end
|
||||
bool end_loop = false;
|
||||
do{
|
||||
scoped_lock<interprocess_mutex> lock(data->mutex);
|
||||
if(!data->message_in){
|
||||
data->cond_empty.wait(lock);
|
||||
}
|
||||
if(std::strcmp(data->items, "last message") == 0){
|
||||
end_loop = true;
|
||||
}
|
||||
else{
|
||||
//Print the message
|
||||
std::cout << data->items << std::endl;
|
||||
//Notify the other process that the buffer is empty
|
||||
data->message_in = false;
|
||||
data->cond_full.notify_one();
|
||||
}
|
||||
}
|
||||
while(!end_loop);
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Erase shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,3 +1,12 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/sync/interprocess_mutex.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_condition.hpp>
|
||||
|
||||
44
example/doc_named_mutex.cpp
Normal file
44
example/doc_named_mutex.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_named_mutex
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <boost/interprocess/sync/named_mutex.hpp>
|
||||
#include <fstream>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
try{
|
||||
|
||||
//Open or create the named mutex
|
||||
named_mutex mutex(open_or_create, "fstream_named_mutex");
|
||||
|
||||
std::ofstream file("file_name");
|
||||
|
||||
for(int i = 0; i < 10; ++i){
|
||||
|
||||
//Do some operations...
|
||||
|
||||
//Write to file atomically
|
||||
scoped_lock<named_mutex> lock(mutex);
|
||||
file << "Process name, ";
|
||||
file << "This is iteration #" << i;
|
||||
file << std::endl;
|
||||
}
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
named_mutex::remove("fstream_named_mutex");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
named_mutex::remove("fstream_named_mutex");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
64
example/doc_node_allocator.cpp
Normal file
64
example/doc_node_allocator.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_node_allocator
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/allocators/node_allocator.hpp>
|
||||
#include <cassert>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
|
||||
try{
|
||||
//Create shared memory
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
|
||||
//Create a node_allocator that allocates ints from the managed segment
|
||||
//The number of chunks per segment is the default value
|
||||
typedef node_allocator<int, managed_shared_memory::segment_manager>
|
||||
node_allocator_t;
|
||||
node_allocator_t allocator_instance(segment.get_segment_manager());
|
||||
|
||||
//Create another node_allocator. Since the segment manager address
|
||||
//is the same, this node_allocator will be
|
||||
//attached to the same pool so "allocator_instance2" can deallocate
|
||||
//nodes allocated by "allocator_instance"
|
||||
node_allocator_t allocator_instance2(segment.get_segment_manager());
|
||||
|
||||
//Create another node_allocator using copy-constructor. This
|
||||
//node_allocator will also be attached to the same pool
|
||||
node_allocator_t allocator_instance3(allocator_instance2);
|
||||
|
||||
//All allocators are equal
|
||||
assert(allocator_instance == allocator_instance2);
|
||||
assert(allocator_instance2 == allocator_instance3);
|
||||
|
||||
//So memory allocated with one can be deallocated with another
|
||||
allocator_instance2.deallocate(allocator_instance.allocate(1), 1);
|
||||
allocator_instance3.deallocate(allocator_instance2.allocate(1), 1);
|
||||
|
||||
//The common pool will be destroyed here, since no allocator is
|
||||
//attached to the pool
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
69
example/doc_offset_ptr.cpp
Normal file
69
example/doc_offset_ptr.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_offset_ptr
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/offset_ptr.hpp>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
//Shared memory linked list node
|
||||
struct list_node
|
||||
{
|
||||
offset_ptr<list_node> next;
|
||||
int value;
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
//Destroy any previous shared memory with the name to be used.
|
||||
//Create an special shared memory from which we can
|
||||
//allocate buffers of raw memory.
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
try{
|
||||
managed_shared_memory segment(
|
||||
create_only,
|
||||
"MySharedMemory",//segment name
|
||||
65536); //segment size in bytes
|
||||
|
||||
//Create linked list with 10 nodes in shared memory
|
||||
offset_ptr<list_node> prev = 0, current, first;
|
||||
|
||||
int i;
|
||||
for(i = 0; i < 10; ++i, prev = current){
|
||||
current = static_cast<list_node*>(segment.allocate(sizeof(list_node)));
|
||||
current->value = i;
|
||||
current->next = 0;
|
||||
|
||||
if(!prev)
|
||||
first = current;
|
||||
else
|
||||
prev->next = current;
|
||||
}
|
||||
|
||||
//Communicate list to other processes
|
||||
//. . .
|
||||
//When done, destroy list
|
||||
for(current = first; current; /**/){
|
||||
prev = current;
|
||||
current = current->next;
|
||||
segment.deallocate(prev.get());
|
||||
}
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
60
example/doc_private_adaptive_pool.cpp
Normal file
60
example/doc_private_adaptive_pool.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_private_adaptive_pool
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/allocators/private_adaptive_pool.hpp>
|
||||
#include <cassert>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
|
||||
try{
|
||||
//Create shared memory
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
|
||||
//Create a private_adaptive_pool that allocates ints from the managed segment
|
||||
//The number of chunks per segment is the default value
|
||||
typedef private_adaptive_pool<int, managed_shared_memory::segment_manager>
|
||||
private_adaptive_pool_t;
|
||||
private_adaptive_pool_t allocator_instance(segment.get_segment_manager());
|
||||
|
||||
//Create another private_adaptive_pool.
|
||||
private_adaptive_pool_t allocator_instance2(segment.get_segment_manager());
|
||||
|
||||
//Although the segment manager address
|
||||
//is the same, this private_adaptive_pool will have its own pool so
|
||||
//"allocator_instance2" CAN'T deallocate nodes allocated by "allocator_instance".
|
||||
//"allocator_instance2" is NOT equal to "allocator_instance"
|
||||
assert(allocator_instance != allocator_instance2);
|
||||
|
||||
//Create another adaptive_pool using copy-constructor.
|
||||
private_adaptive_pool_t allocator_instance3(allocator_instance2);
|
||||
|
||||
//This allocator is also unequal to allocator_instance2
|
||||
assert(allocator_instance2 != allocator_instance3);
|
||||
|
||||
//Pools are destroyed with the allocators
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
60
example/doc_private_node_allocator.cpp
Normal file
60
example/doc_private_node_allocator.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_private_node_allocator
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/allocators/private_node_allocator.hpp>
|
||||
#include <cassert>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
int main ()
|
||||
{
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
|
||||
try{
|
||||
//Create shared memory
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
|
||||
//Create a private_node_allocator that allocates ints from the managed segment
|
||||
//The number of chunks per segment is the default value
|
||||
typedef private_node_allocator<int, managed_shared_memory::segment_manager>
|
||||
private_node_allocator_t;
|
||||
private_node_allocator_t allocator_instance(segment.get_segment_manager());
|
||||
|
||||
//Create another private_node_allocator.
|
||||
private_node_allocator_t allocator_instance2(segment.get_segment_manager());
|
||||
|
||||
//Although the segment manager address
|
||||
//is the same, this private_node_allocator will have its own pool so
|
||||
//"allocator_instance2" CAN'T deallocate nodes allocated by "allocator_instance".
|
||||
//"allocator_instance2" is NOT equal to "allocator_instance"
|
||||
assert(allocator_instance != allocator_instance2);
|
||||
|
||||
//Create another node_allocator using copy-constructor.
|
||||
private_node_allocator_t allocator_instance3(allocator_instance2);
|
||||
|
||||
//This allocator is also unequal to allocator_instance2
|
||||
assert(allocator_instance2 != allocator_instance3);
|
||||
|
||||
//Pools are destroyed with the allocators
|
||||
}
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,44 +1,54 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_scoped_ptr
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/smart_ptr/scoped_ptr.hpp>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/smart_ptr/scoped_ptr.hpp>
|
||||
using namespace boost::interprocess;
|
||||
|
||||
using namespace boost::interprocess;
|
||||
class my_class
|
||||
{};
|
||||
|
||||
class my_class
|
||||
{};
|
||||
class my_exception
|
||||
{};
|
||||
|
||||
class my_exception
|
||||
{};
|
||||
//A functor that destroys the shared memory object
|
||||
template<class T>
|
||||
class my_deleter
|
||||
{
|
||||
private:
|
||||
//A typedef to save typing
|
||||
typedef managed_shared_memory::segment_manager segment_manager;
|
||||
//This my_deleter is created in the stack, not in shared memory,
|
||||
//so we can use raw pointers
|
||||
segment_manager *mp_segment_manager;
|
||||
|
||||
//A functor that destroys the shared memory object
|
||||
template<class T>
|
||||
class my_deleter
|
||||
{
|
||||
private:
|
||||
//A typedef to save typing
|
||||
typedef managed_shared_memory::segment_manager segment_manager;
|
||||
//This my_deleter is created in the stack, not in shared memory,
|
||||
//so we can use raw pointers
|
||||
segment_manager *mp_segment_manager;
|
||||
|
||||
public:
|
||||
//This typedef will specify the pointer type that
|
||||
//scoped_ptr will store
|
||||
typedef T *pointer;
|
||||
//Constructor
|
||||
my_deleter(segment_manager *s_mngr)
|
||||
: mp_segment_manager(s_mngr){}
|
||||
public:
|
||||
//This typedef will specify the pointer type that
|
||||
//scoped_ptr will store
|
||||
typedef T *pointer;
|
||||
//Constructor
|
||||
my_deleter(segment_manager *s_mngr)
|
||||
: mp_segment_manager(s_mngr){}
|
||||
|
||||
void operator()(pointer object_to_delete)
|
||||
{ mp_segment_manager->destroy_ptr(object_to_delete); }
|
||||
};
|
||||
void operator()(pointer object_to_delete)
|
||||
{ mp_segment_manager->destroy_ptr(object_to_delete); }
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
//Create shared memory
|
||||
shared_memory_object::remove("my_shmem");
|
||||
int main ()
|
||||
{
|
||||
//Create shared memory
|
||||
shared_memory_object::remove("my_shmem");
|
||||
try{
|
||||
managed_shared_memory shmem(create_only, "my_shmem", 10000);
|
||||
|
||||
//In the first try, there will be no exceptions
|
||||
@@ -65,7 +75,6 @@
|
||||
s_ptr.release();
|
||||
}
|
||||
catch(const my_exception &){}
|
||||
|
||||
//Here, scoped_ptr is destroyed
|
||||
//so it we haven't thrown an exception
|
||||
//the object should be there, otherwise, destroyed
|
||||
@@ -84,7 +93,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
catch(...){
|
||||
shared_memory_object::remove("my_shmem");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("my_shmem");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
43
example/doc_shared_memory.cpp
Normal file
43
example/doc_shared_memory.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_shared_memory
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
try{
|
||||
//Erase previous shared memory
|
||||
shared_memory_object::remove("shared_memory");
|
||||
|
||||
//Create a shared memory object.
|
||||
shared_memory_object shm (create_only, "shared_memory", read_write);
|
||||
|
||||
//Set size
|
||||
shm.truncate(1000);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region(shm, read_write);
|
||||
|
||||
//Write all the memory to 1
|
||||
std::memset(region.get_address(), 1, region.get_size());
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
shared_memory_object::remove("shared_memory");
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
shared_memory_object::remove("shared_memory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
43
example/doc_shared_memory2.cpp
Normal file
43
example/doc_shared_memory2.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_shared_memory2
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
try{
|
||||
//Open already created shared memory object.
|
||||
shared_memory_object shm (open_only, "shared_memory", read_only);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region(shm, read_only);
|
||||
|
||||
//Check that memory was initialized to 1
|
||||
const char *mem = static_cast<char*>(region.get_address());
|
||||
for(std::size_t i = 0; i < region.get_size(); ++i){
|
||||
if(*mem++ != 1){
|
||||
std::cout << "Error checking memory!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
std::cout << "Test successful!" << std::endl;
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << "Unexpected exception: " << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
@@ -1,3 +1,12 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
|
||||
|
||||
struct shared_data
|
||||
@@ -1,27 +1,37 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_vectorstream
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/containers/string.hpp>
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/streams/vectorstream.hpp>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/containers/string.hpp>
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/streams/vectorstream.hpp>
|
||||
#include <iterator>
|
||||
|
||||
using namespace boost::interprocess;
|
||||
using namespace boost::interprocess;
|
||||
|
||||
typedef allocator<int, managed_shared_memory::segment_manager>
|
||||
IntAllocator;
|
||||
typedef allocator<char, managed_shared_memory::segment_manager>
|
||||
CharAllocator;
|
||||
typedef vector<int, IntAllocator> MyVector;
|
||||
typedef basic_string
|
||||
<char, std::char_traits<char>, CharAllocator> MyString;
|
||||
typedef basic_vectorstream<MyString> MyVectorStream;
|
||||
typedef allocator<int, managed_shared_memory::segment_manager>
|
||||
IntAllocator;
|
||||
typedef allocator<char, managed_shared_memory::segment_manager>
|
||||
CharAllocator;
|
||||
typedef vector<int, IntAllocator> MyVector;
|
||||
typedef basic_string
|
||||
<char, std::char_traits<char>, CharAllocator> MyString;
|
||||
typedef basic_vectorstream<MyString> MyVectorStream;
|
||||
|
||||
int main ()
|
||||
{
|
||||
//Create shared memory
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
int main ()
|
||||
{
|
||||
//Create shared memory
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
try{
|
||||
managed_shared_memory segment(
|
||||
create_only,
|
||||
"MySharedMemory",//segment name
|
||||
@@ -76,7 +86,7 @@
|
||||
MyString *mystring =
|
||||
segment.construct<MyString>("MyString")
|
||||
(CharAllocator(segment.get_segment_manager()));
|
||||
|
||||
|
||||
//...and we swap vectorstream's internal string
|
||||
//with the new one: after this statement mystring
|
||||
//will be the owner of the formatted data.
|
||||
@@ -90,7 +100,13 @@
|
||||
segment.destroy_ptr(myvector2);
|
||||
segment.destroy_ptr(myvector);
|
||||
segment.destroy_ptr(mystring);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
catch(...){
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("MySharedMemory");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
@@ -1,26 +1,36 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[doc_where_allocate
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/containers/string.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/containers/string.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
//Typedefs
|
||||
typedef allocator<char, managed_shared_memory::segment_manager>
|
||||
CharAllocator;
|
||||
typedef basic_string<char, std::char_traits<char>, CharAllocator>
|
||||
MyShmString;
|
||||
typedef allocator<MyShmString, managed_shared_memory::segment_manager>
|
||||
StringAllocator;
|
||||
typedef vector<MyShmString, StringAllocator>
|
||||
MyShmStringVector;
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
//Typedefs
|
||||
typedef allocator<char, managed_shared_memory::segment_manager>
|
||||
CharAllocator;
|
||||
typedef basic_string<char, std::char_traits<char>, CharAllocator>
|
||||
MyShmString;
|
||||
typedef allocator<MyShmString, managed_shared_memory::segment_manager>
|
||||
StringAllocator;
|
||||
typedef vector<MyShmString, StringAllocator>
|
||||
MyShmStringVector;
|
||||
|
||||
//Open shared memory
|
||||
shared_memory_object::remove("myshm");
|
||||
//Open shared memory
|
||||
shared_memory_object::remove("myshm");
|
||||
try{
|
||||
managed_shared_memory shm(create_only, "myshm", 10000);
|
||||
|
||||
//Create allocators
|
||||
@@ -52,7 +62,13 @@
|
||||
|
||||
//Destroy vector. This will free all strings that the vector contains
|
||||
shm.destroy_ptr(myshmvector);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
catch(...){
|
||||
shared_memory_object::remove("myshm");
|
||||
throw;
|
||||
}
|
||||
shared_memory_object::remove("myshm");
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
48
example/doc_windows_shared_memory.cpp
Normal file
48
example/doc_windows_shared_memory.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#ifdef BOOST_WINDOWS
|
||||
//[doc_windows_shared_memory
|
||||
#include <boost/interprocess/windows_shared_memory.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
try{
|
||||
//Create a native windows shared memory object.
|
||||
windows_shared_memory shm (create_only, "shared_memory", read_write, 1000);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region(shm, read_write);
|
||||
|
||||
//Write all the memory to 1
|
||||
std::memset(region.get_address(), 1, 1000);
|
||||
|
||||
//Launch the client process and wait until finishes...
|
||||
//...
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
#else //#ifdef BOOST_WINDOWS
|
||||
int main()
|
||||
{ return 0; }
|
||||
#endif//#ifdef BOOST_WINDOWS
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
44
example/doc_windows_shared_memory2.cpp
Normal file
44
example/doc_windows_shared_memory2.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztañaga 2006-2007. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//[doc_windows_shared_memory2
|
||||
#include <boost/interprocess/windows_shared_memory.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
int main ()
|
||||
{
|
||||
using namespace boost::interprocess;
|
||||
try{
|
||||
//Open already created shared memory object.
|
||||
windows_shared_memory shm(open_only, "shared_memory", read_only);
|
||||
|
||||
//Map the whole shared memory in this process
|
||||
mapped_region region (shm, read_only);
|
||||
|
||||
//Check that memory was initialized to 1
|
||||
const char *mem = static_cast<char*>(region.get_address());
|
||||
for(std::size_t i = 0; i < 1000; ++i){
|
||||
if(*mem++ != 1){
|
||||
std::cout << "Error checking memory!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Test successful!" << std::endl;
|
||||
}
|
||||
catch(interprocess_exception &ex){
|
||||
std::cout << "Unexpected exception: " << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
@@ -3,10 +3,6 @@
|
||||
<meta http-equiv="refresh" content="0; URL=doc/html/index.html">
|
||||
</head>
|
||||
<body>
|
||||
Automatic redirection failed, please go to <a href="doc/html/index.html">doc/html/interprocess.html</a> <hr>
|
||||
<p>© Copyright Beman Dawes, 2001</p>
|
||||
<p>Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy
|
||||
at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
|
||||
Automatic redirection failed, please go to <a href="doc/html/index.html">doc/html/interprocess.html</a>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
35
proj/conceptgcc/MakeAll
Normal file
35
proj/conceptgcc/MakeAll
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
ifndef CC
|
||||
CC=i686-pc-cygwin-gcc.exe
|
||||
endif
|
||||
|
||||
BOOST_ROOT=../../../..
|
||||
|
||||
INTERPROCESS_CPP := $(wildcard ../../src/*.cpp)
|
||||
INTERPROCESS_OBJ := $(patsubst ../../src/%.cpp, lib_%.o, $(INTERPROCESS_CPP))
|
||||
|
||||
INTERPROCESSTEST_CPP := $(wildcard ../../test/*.cpp)
|
||||
INTERPROCESSTEST_OUT := $(patsubst ../../test/%.cpp, ../../bin/conceptgcc/test_%.out, $(INTERPROCESSTEST_CPP))
|
||||
|
||||
INTERPROCESSDOC_CPP := $(wildcard ../../example/*.cpp)
|
||||
INTERPROCESSDOC_OUT := $(patsubst ../../example/%.cpp, ../../bin/conceptgcc/ex_%.out, $(INTERPROCESSDOC_CPP))
|
||||
|
||||
LIBDIR:= ../../../../stage/lib
|
||||
|
||||
.PHONY: createdir clean
|
||||
|
||||
all: createdir $(INTERPROCESSTEST_OUT) $(INTERPROCESSDOC_OUT)
|
||||
@cd .
|
||||
|
||||
createdir:
|
||||
@mkdir -p ../../bin/conceptgcc
|
||||
|
||||
../../bin/conceptgcc/test_%.out: ../../test/%.cpp
|
||||
$(CC) $< -Wall -DBOOST_DATE_TIME_NO_LIB -L$(LIBDIR) -lboost_thread-mgw-mt -I$(BOOST_ROOT) -lstdc++ -o $@
|
||||
|
||||
../../bin/conceptgcc/ex_%.out: ../../example/%.cpp
|
||||
$(CC) $< -Wall -DBOOST_DATE_TIME_NO_LIB -L$(LIBDIR)-lboost_thread-mgw-mt -I$(BOOST_ROOT) -lstdc++ -o $@
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f ../../bin/conceptgcc/*
|
||||
@@ -14,14 +14,14 @@ INTERPROCESSTEST_OUT := $(patsubst ../../test/%.cpp, ../../bin/cygwin/test_%.out
|
||||
INTERPROCESSEXAMPLE_CPP := $(wildcard ../../example/*.cpp)
|
||||
INTERPROCESSEXAMPLE_OUT := $(patsubst ../../example/%.cpp, ../../bin/cygwin/ex_%.out, $(INTERPROCESSEXAMPLE_CPP))
|
||||
|
||||
INTERPROCESSDOC_CPP := $(wildcard ../../doc/code/*.cpp)
|
||||
INTERPROCESSDOC_OUT := $(patsubst ../../doc/code/%.cpp, ../../bin/cygwin/doc_%.out, $(INTERPROCESSDOC_CPP))
|
||||
INTERPROCESSEXAMPLE_CPP := $(wildcard ../../example/*.cpp)
|
||||
INTERPROCESSEXAMPLE_OUT := $(patsubst ../../example/%.cpp, ../../bin/cygwin/ex__%.out, $(INTERPROCESSEXAMPLE_CPP))
|
||||
|
||||
LIBDIR:= ../../../../stage/lib
|
||||
|
||||
.PHONY: createdir clean
|
||||
|
||||
all: createdir $(INTERPROCESSEXAMPLE_OUT) $(INTERPROCESSTEST_OUT) $(INTERPROCESSDOC_OUT)
|
||||
all: createdir $(INTERPROCESSEXAMPLE_OUT) $(INTERPROCESSTEST_OUT) $(INTERPROCESSEXAMPLE_OUT)
|
||||
@cd .
|
||||
|
||||
createdir:
|
||||
@@ -33,8 +33,6 @@ createdir:
|
||||
../../bin/cygwin/ex_%.out: ../../example/%.cpp
|
||||
$(CC) -g $< -Wall -DBOOST_DATE_TIME_NO_LIB -L$(LIBDIR)-lboost_thread-gcc-mt -I$(BOOST_ROOT) -lstdc++ -o $@
|
||||
|
||||
../../bin/cygwin/doc_%.out: ../../doc/code/%.cpp
|
||||
$(CC) -g $< -Wall -DBOOST_DATE_TIME_NO_LIB -L$(LIBDIR)-lboost_thread-gcc-mt -I$(BOOST_ROOT) -lstdc++ -o $@
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
|
||||
@@ -13,12 +13,9 @@ INTERPROCESS_OUT := $(patsubst ../../test/%.cpp, ../../bin/linux/test_%.out, $(I
|
||||
INTERPROCESSEXAMPLE_CPP := $(wildcard ../../example/*.cpp)
|
||||
INTERPROCESSEXAMPLE_OUT := $(patsubst ../../example/%.cpp, ../../bin/linux/ex_%.out, $(INTERPROCESSEXAMPLE_CPP))
|
||||
|
||||
INTERPROCESSDOC_CPP := $(wildcard ../../doc/code/*.cpp)
|
||||
INTERPROCESSDOC_OUT := $(patsubst ../../doc/code/%.cpp, ../../bin/linux/doc_%.out, $(INTERPROCESSDOC_CPP))
|
||||
|
||||
.PHONY: createdir clean
|
||||
|
||||
all: createdir $(INTERPROCESSEXAMPLE_OUT) $(INTERPROCESS_OUT) $(INTERPROCESSDOC_OUT)
|
||||
all: createdir $(INTERPROCESS_OUT) $(INTERPROCESSEXAMPLE_OUT)
|
||||
@cd .
|
||||
|
||||
createdir:
|
||||
@@ -30,9 +27,6 @@ createdir:
|
||||
../../bin/linux/ex_%.out: ../../example/%.cpp
|
||||
$(CC) $< -Wall -pedantic -g -pthread -DBOOST_DATE_TIME_NO_LIB -lstdc++ -lrt -lboost_thread-gcc-mt -I$(BOOST_ROOT) -L$(BOOST_LIBS) -o $@
|
||||
|
||||
../../bin/linux/doc_%.out: ../../doc/code/%.cpp
|
||||
$(CC) $< -Wall -pedantic -g -pthread -DBOOST_DATE_TIME_NO_LIB -lstdc++ -lrt -lboost_thread-gcc-mt -I$(BOOST_ROOT) -L$(BOOST_LIBS) -o $@
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f ../../bin/linux/*
|
||||
|
||||
@@ -14,14 +14,11 @@ INTERPROCESSTEST_OUT := $(patsubst ../../test/%.cpp, ../../bin/mingw/test_%.out,
|
||||
INTERPROCESSEXAMPLE_CPP := $(wildcard ../../example/*.cpp)
|
||||
INTERPROCESSEXAMPLE_OUT := $(patsubst ../../example/%.cpp, ../../bin/mingw/ex_%.out, $(INTERPROCESSEXAMPLE_CPP))
|
||||
|
||||
INTERPROCESSDOC_CPP := $(wildcard ../../doc/code/*.cpp)
|
||||
INTERPROCESSDOC_OUT := $(patsubst ../../doc/code/%.cpp, ../../bin/mingw/doc_%.out, $(INTERPROCESSDOC_CPP))
|
||||
|
||||
LIBDIR:= ../../../../stage/lib
|
||||
|
||||
.PHONY: createdir clean
|
||||
|
||||
all: createdir $(INTERPROCESSEXAMPLE_OUT) $(INTERPROCESSTEST_OUT) $(INTERPROCESSDOC_OUT)
|
||||
all: createdir $(INTERPROCESSTEST_OUT) $(INTERPROCESSEXAMPLE_OUT)
|
||||
@cd .
|
||||
|
||||
createdir:
|
||||
@@ -33,9 +30,6 @@ createdir:
|
||||
../../bin/mingw/ex_%.out: ../../example/%.cpp
|
||||
$(CC) $< -Wall -DBOOST_DATE_TIME_NO_LIB -L$(LIBDIR)-lboost_thread-mgw-mt -I$(BOOST_ROOT) -lstdc++ -o $@
|
||||
|
||||
../../bin/mingw/doc_%.out: ../../doc/code/%.cpp
|
||||
$(CC) $< -Wall -DBOOST_DATE_TIME_NO_LIB -L$(LIBDIR)-lboost_thread-mgw-mt -I$(BOOST_ROOT) -lstdc++ -o $@
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f ../../bin/mingw/*
|
||||
|
||||
@@ -14,12 +14,9 @@ INTERPROCESSTEST_OUT := $(patsubst ../../test/%.cpp, ../../bin/qnx/test_%.out, $
|
||||
INTERPROCESSEXAMPLE_CPP := $(wildcard ../../example/*.cpp)
|
||||
INTERPROCESSEXAMPLE_OUT := $(patsubst ../../example/%.cpp, ../../bin/qnx/ex_%.out, $(INTERPROCESSEXAMPLE_CPP))
|
||||
|
||||
INTERPROCESSDOC_CPP := $(wildcard ../../doc/code/*.cpp)
|
||||
INTERPROCESSDOC_OUT := $(patsubst ../../doc/code/%.cpp, ../../bin/qnx/doc_%.out, $(INTERPROCESSDOC_CPP))
|
||||
|
||||
.PHONY: createdir clean
|
||||
|
||||
all: createdir $(INTERPROCESSEXAMPLE_OUT) $(INTERPROCESSTEST_OUT) $(INTERPROCESSDOC_OUT)
|
||||
|
||||
all: createdir $(INTERPROCESSTEST_OUT) $(INTERPROCESSEXAMPLE_OUT)
|
||||
@cd .
|
||||
|
||||
createdir:
|
||||
@@ -31,9 +28,6 @@ createdir:
|
||||
../../bin/qnx/ex_%.out: ../../example/%.cpp
|
||||
$(CC) $< -Wall -DBOOST_DATE_TIME_NO_LIB -lboost_thread-gcc-mt-s -I$(BOOST_ROOT) -o $@
|
||||
|
||||
../../bin/qnx/doc_%.out: ../../doc/code/%.cpp
|
||||
$(CC) $< -Wall -DBOOST_DATE_TIME_NO_LIB -lboost_thread-gcc-mt-s -I$(BOOST_ROOT) -o $@
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f ../../bin/qnx/*
|
||||
|
||||
@@ -1,133 +1,133 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="ProcessA"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792619}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/ProcessA"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessA_d.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/ProcessA.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/ProcessA"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessA.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\example\process_a_example.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="ProcessA"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792619}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/ProcessA"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessA_d.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/ProcessA.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/ProcessA"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessA.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\example\process_a_example.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
@@ -1,133 +1,133 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="ProcessAFixed"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792618}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/ProcessAFixed"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessAFixed_d.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/ProcessAFixed.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/ProcessAFixed"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessAFixed.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\example\process_a_fixed_example.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="ProcessAFixed"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792618}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/ProcessAFixed"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessAFixed_d.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/ProcessAFixed.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/ProcessAFixed"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessAFixed.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\example\process_a_fixed_example.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
@@ -1,132 +1,132 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="ProcessB"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792617}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/ProcessB"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessB_d.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/ProcessB.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/ProcessB"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessB.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\example\process_b_example.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="ProcessB"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792617}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/ProcessB"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessB_d.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/ProcessB.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/ProcessB"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessB.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\example\process_b_example.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
@@ -1,132 +1,132 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="ProcessBFixed"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792616}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/ProcessBFixed"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessBFixed_d.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/ProcessBFixed.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/ProcessBFixed"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessBFixed.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\example\process_b_fixed_example.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="ProcessBFixed"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792616}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/ProcessBFixed"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessBFixed_d.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/ProcessBFixed.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/ProcessBFixed"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/ProcessBFixed.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\example\process_b_fixed_example.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
@@ -1,134 +1,134 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="allocate_ex"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792663}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/allocate_ex"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/allocate_ex_d.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/allocate_ex.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
FixedBaseAddress="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/allocate_ex"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/allocate_ex.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\example\alloc_example.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="allocate_ex"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792663}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/allocate_ex"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/allocate_ex_d.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/allocate_ex.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
FixedBaseAddress="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/allocate_ex"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/allocate_ex.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\example\alloc_example.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
@@ -1,134 +1,134 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="file_lock_test"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792639}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/file_lock_test"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/file_lock_test_d.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/file_lock_test.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
FixedBaseAddress="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/file_lock_test"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/file_lock_test.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{7FCFEF41-3746-C7A5-8B8E-A352A2F22D7F}">
|
||||
<File
|
||||
RelativePath="..\..\test\file_lock_test.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{95393980-8912-4b74-66A0-607BE52EB5FB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="file_lock_test"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792639}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/file_lock_test"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/file_lock_test_d.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/file_lock_test.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
FixedBaseAddress="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/file_lock_test"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/file_lock_test.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{7FCFEF41-3746-C7A5-8B8E-A352A2F22D7F}">
|
||||
<File
|
||||
RelativePath="..\..\test\file_lock_test.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{95393980-8912-4b74-66A0-607BE52EB5FB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
@@ -1,134 +1,134 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="hash_table_test"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792636}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/hash_table_ex"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/hash_table_ex_d.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/hash_table_ex.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
FixedBaseAddress="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/hash_table_ex"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/hash_table_ex.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\test\hash_table_test.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="hash_table_test"
|
||||
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792636}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Debug"
|
||||
IntermediateDirectory="Debug/hash_table_ex"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/hash_table_ex_d.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/hash_table_ex.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
FixedBaseAddress="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Bin/Win32/Release"
|
||||
IntermediateDirectory="Release/hash_table_ex"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="winmm.lib"
|
||||
OutputFile="$(OutDir)/hash_table_ex.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../../stage/lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\test\hash_table_test.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user