mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
Removed trailing whitespaces.
This commit is contained in:
@@ -1800,10 +1800,10 @@ To sum up:
|
||||
|
||||
[section:upgradable_transitions Lock transitions for Upgradable Mutex]
|
||||
|
||||
A sharable mutex has no option to change the acquired lock for another lock
|
||||
A sharable mutex has no option to change the acquired lock for another lock
|
||||
atomically.
|
||||
|
||||
On the other hand, for an upgradable mutex, a thread that has
|
||||
On the other hand, for an upgradable mutex, a thread that has
|
||||
acquired a lock can try to acquire another lock type atomically.
|
||||
All lock transitions are not guaranteed to succeed. Even if a transition is guaranteed
|
||||
to succeed, some transitions will block the thread waiting until other threads release
|
||||
@@ -3919,7 +3919,7 @@ There are 2 types of `allocate_many` functions:
|
||||
|
||||
[c++]
|
||||
|
||||
//!Allocates n_elements of elem_bytes bytes.
|
||||
//!Allocates n_elements of elem_bytes bytes.
|
||||
//!Throws bad_alloc on failure. chain.size() is not increased on failure.
|
||||
void allocate_many(size_type elem_bytes, size_type n_elements, multiallocation_chain &chain);
|
||||
|
||||
@@ -3927,7 +3927,7 @@ There are 2 types of `allocate_many` functions:
|
||||
//!Throws bad_alloc on failure. chain.size() is not increased on failure.
|
||||
void allocate_many(const size_type *element_lengths, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain);
|
||||
|
||||
//!Allocates n_elements of elem_bytes bytes.
|
||||
//!Allocates n_elements of elem_bytes bytes.
|
||||
//!Non-throwing version. chain.size() is not increased on failure.
|
||||
void allocate_many(std::nothrow_t, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain);
|
||||
|
||||
@@ -6739,7 +6739,7 @@ thank them:
|
||||
[section:release_notes Release Notes]
|
||||
|
||||
[section:release_notes_boost_1_56_00 Boost 1.56 Release]
|
||||
* Fixed bugs:
|
||||
* Fixed bugs:
|
||||
* [@https://svn.boost.org/trac/boost/ticket/9221 Trac #9221 (['"message_queue deadlock on linux"])].
|
||||
* [@https://svn.boost.org/trac/boost/ticket/9226 Trac #9226 (['"On some computers, Common Appdata is empty in registry, so boost interprocess cannot work"])].
|
||||
* [@https://svn.boost.org/trac/boost/ticket/9284 Trac #9284 (['"WaitForSingleObject(mutex) must handle WAIT_ABANDONED"])].
|
||||
|
||||
@@ -307,7 +307,7 @@ class basic_managed_memory_impl
|
||||
|
||||
//Experimental. Don't use.
|
||||
|
||||
//!Allocates n_elements of elem_bytes bytes.
|
||||
//!Allocates n_elements of elem_bytes bytes.
|
||||
//!Throws bad_alloc on failure. chain.size() is not increased on failure.
|
||||
void allocate_many(size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
|
||||
{ mp_header->allocate_many(elem_bytes, n_elements, chain); }
|
||||
@@ -317,7 +317,7 @@ class basic_managed_memory_impl
|
||||
void allocate_many(const size_type *element_lengths, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain)
|
||||
{ mp_header->allocate_many(element_lengths, n_elements, sizeof_element, chain); }
|
||||
|
||||
//!Allocates n_elements of elem_bytes bytes.
|
||||
//!Allocates n_elements of elem_bytes bytes.
|
||||
//!Non-throwing version. chain.size() is not increased on failure.
|
||||
void allocate_many(std::nothrow_t, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
|
||||
{ mp_header->allocate_many(std::nothrow_t(), elem_bytes, n_elements, chain); }
|
||||
|
||||
@@ -153,7 +153,7 @@ inline OS_highres_count_t system_highres_count_subtract(const OS_highres_count_t
|
||||
{ return l - r; }
|
||||
|
||||
inline bool system_highres_count_less(const OS_highres_count_t &l, const OS_highres_count_t &r)
|
||||
{ return l < r; }
|
||||
{ return l < r; }
|
||||
|
||||
inline bool system_highres_count_less_ul(const OS_highres_count_t &l, unsigned long r)
|
||||
{ return l < static_cast<OS_highres_count_t>(r); }
|
||||
@@ -305,8 +305,8 @@ inline unsigned long get_system_tick_in_highres_counts()
|
||||
mach_timebase_info(&info);
|
||||
//ns
|
||||
return static_cast<unsigned long>
|
||||
(
|
||||
static_cast<double>(get_system_tick_ns())
|
||||
(
|
||||
static_cast<double>(get_system_tick_ns())
|
||||
/ (static_cast<double>(info.numer) / info.denom)
|
||||
);
|
||||
#endif
|
||||
@@ -349,11 +349,11 @@ inline OS_highres_count_t system_highres_count_subtract(const OS_highres_count_t
|
||||
OS_highres_count_t res;
|
||||
|
||||
if (l.tv_nsec < r.tv_nsec){
|
||||
res.tv_nsec = 1000000000 + l.tv_nsec - r.tv_nsec;
|
||||
res.tv_nsec = 1000000000 + l.tv_nsec - r.tv_nsec;
|
||||
res.tv_sec = l.tv_sec - 1 - r.tv_sec;
|
||||
}
|
||||
else{
|
||||
res.tv_nsec = l.tv_nsec - r.tv_nsec;
|
||||
res.tv_nsec = l.tv_nsec - r.tv_nsec;
|
||||
res.tv_sec = l.tv_sec - r.tv_sec;
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ inline bool system_highres_count_less(const OS_highres_count_t &l, const OS_high
|
||||
{ return l.tv_sec < r.tv_sec || (l.tv_sec == r.tv_sec && l.tv_nsec < r.tv_nsec); }
|
||||
|
||||
inline bool system_highres_count_less_ul(const OS_highres_count_t &l, unsigned long r)
|
||||
{ return !l.tv_sec && (static_cast<unsigned long>(l.tv_nsec) < r); }
|
||||
{ return !l.tv_sec && (static_cast<unsigned long>(l.tv_nsec) < r); }
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -148,9 +148,9 @@ template<class SizeType>
|
||||
inline bool multiplication_overflows(SizeType a, SizeType b)
|
||||
{
|
||||
const SizeType sqrt_size_max = sqrt_size_type_max<SizeType>::value;
|
||||
return //Fast runtime check
|
||||
return //Fast runtime check
|
||||
( (a | b) > sqrt_size_max &&
|
||||
//Slow division check
|
||||
//Slow division check
|
||||
b && a > SizeType(-1)/b
|
||||
);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ typedef unsigned short *bstr;
|
||||
|
||||
struct wchar_variant
|
||||
{
|
||||
union
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
@@ -106,7 +106,7 @@ struct wchar_variant
|
||||
unsigned short wReserved1;
|
||||
unsigned short wReserved2;
|
||||
unsigned short wReserved3;
|
||||
union
|
||||
union
|
||||
{
|
||||
bstr bstrVal;
|
||||
struct
|
||||
@@ -1547,7 +1547,7 @@ const char *function_address_holder<Dummy>::FunctionNames[function_address_holde
|
||||
};
|
||||
|
||||
template<int Dummy>
|
||||
unsigned int function_address_holder<Dummy>::FunctionModules[function_address_holder<Dummy>::NumFunction] =
|
||||
unsigned int function_address_holder<Dummy>::FunctionModules[function_address_holder<Dummy>::NumFunction] =
|
||||
{
|
||||
NtDll_dll,
|
||||
NtDll_dll,
|
||||
@@ -1563,7 +1563,7 @@ unsigned int function_address_holder<Dummy>::FunctionModules[function_address_ho
|
||||
};
|
||||
|
||||
template<int Dummy>
|
||||
const char *function_address_holder<Dummy>::ModuleNames[function_address_holder<Dummy>::NumModule] =
|
||||
const char *function_address_holder<Dummy>::ModuleNames[function_address_holder<Dummy>::NumModule] =
|
||||
{
|
||||
"ntdll.dll",
|
||||
"kernel32.dll"
|
||||
@@ -1667,7 +1667,7 @@ inline void buffer_to_wide_str(const void *buf, std::size_t length, wchar_t *str
|
||||
}
|
||||
}
|
||||
|
||||
inline bool get_boot_and_system_time_wstr(wchar_t *bootsystemstamp, std::size_t &s)
|
||||
inline bool get_boot_and_system_time_wstr(wchar_t *bootsystemstamp, std::size_t &s)
|
||||
//will write BootAndSystemstampLength chars
|
||||
{
|
||||
if(s < (BootAndSystemstampLength*2))
|
||||
@@ -1744,7 +1744,7 @@ class nt_query_mem_deleter
|
||||
}
|
||||
|
||||
ntquery_mem_t *query_mem() const
|
||||
{ return static_cast<ntquery_mem_t *>(static_cast<void*>(m_buf)); }
|
||||
{ return static_cast<ntquery_mem_t *>(static_cast<void*>(m_buf)); }
|
||||
|
||||
unsigned long object_name_information_size() const
|
||||
{
|
||||
@@ -2197,22 +2197,22 @@ inline bool get_last_bootup_time(std::string &stamp)
|
||||
void *hEventLog = OpenEventLogA(0, source_name);
|
||||
if (hEventLog){
|
||||
eventlog_handle_closer hnd_closer(hEventLog); (void)hnd_closer;
|
||||
// Allocate an initial block of memory used to read event records. The number
|
||||
// Allocate an initial block of memory used to read event records. The number
|
||||
// of records read into the buffer will vary depending on the size of each event.
|
||||
// The size of each event will vary based on the size of the user-defined
|
||||
// data included with each event, the number and length of insertion
|
||||
// data included with each event, the number and length of insertion
|
||||
// strings, and other data appended to the end of the event record.
|
||||
dwBytesToRead = max_record_buffer_size;
|
||||
c_heap_deleter heap_deleter(dwBytesToRead);
|
||||
|
||||
// Read blocks of records until you reach the end of the log or an
|
||||
// Read blocks of records until you reach the end of the log or an
|
||||
// error occurs. The records are read from newest to oldest. If the buffer
|
||||
// is not big enough to hold a complete event record, reallocate the buffer.
|
||||
if (heap_deleter.get() != 0){
|
||||
while (0 == status){
|
||||
if (!ReadEventLogA(hEventLog,
|
||||
if (!ReadEventLogA(hEventLog,
|
||||
eventlog_sequential_read | eventlog_backwards_read,
|
||||
0,
|
||||
0,
|
||||
heap_deleter.get(),
|
||||
dwBytesToRead,
|
||||
&dwBytesRead,
|
||||
@@ -2281,7 +2281,7 @@ inline bool get_semaphore_info(void *handle, long &count, long &limit)
|
||||
return !status;
|
||||
}
|
||||
|
||||
inline bool query_timer_resolution(unsigned long *lowres, unsigned long *highres, unsigned long *curres)
|
||||
inline bool query_timer_resolution(unsigned long *lowres, unsigned long *highres, unsigned long *curres)
|
||||
{
|
||||
winapi::NtQueryTimerResolution_t pNtQueryTimerResolution =
|
||||
(winapi::NtQueryTimerResolution_t)dll_func::get(winapi::dll_func::NtQueryTimerResolution);
|
||||
|
||||
@@ -250,7 +250,7 @@ class priority_functor
|
||||
//! if two messages have the same priority. So the next message to be
|
||||
//! used in a "receive" is pointed by index [(cur_first_msg + cur_num_msg-1)%max_num_msg]
|
||||
//! and the first free message ready to be used in a "send" operation is
|
||||
//! [cur_first_msg] if circular buffer is extended from front,
|
||||
//! [cur_first_msg] if circular buffer is extended from front,
|
||||
//! [(cur_first_msg + cur_num_msg)%max_num_msg] otherwise.
|
||||
//!
|
||||
//! This transforms the index in a circular buffer with an embedded free
|
||||
@@ -356,7 +356,7 @@ class mq_hdr_t
|
||||
iterator begin(this->inserted_ptr_begin()), end(this->inserted_ptr_end());
|
||||
if(end < begin){
|
||||
iterator idx_end = &mp_index[m_max_num_msg];
|
||||
iterator ret = std::lower_bound(begin, idx_end, value, func);
|
||||
iterator ret = std::lower_bound(begin, idx_end, value, func);
|
||||
if(idx_end == ret){
|
||||
iterator idx_beg = &mp_index[0];
|
||||
ret = std::lower_bound(idx_beg, end, value, func);
|
||||
|
||||
@@ -186,7 +186,7 @@ class mapped_region
|
||||
|
||||
//!This enum specifies region usage behaviors that an application can specify
|
||||
//!to the mapped region implementation.
|
||||
enum advice_types{
|
||||
enum advice_types{
|
||||
//!Specifies that the application has no advice to give on its behavior with respect to
|
||||
//!the region. It is the default characteristic if no advice is given for a range of memory.
|
||||
advice_normal,
|
||||
@@ -520,7 +520,7 @@ inline bool mapped_region::shrink_by(std::size_t bytes, bool from_back)
|
||||
}
|
||||
else if(shrink_page_bytes){
|
||||
//In Windows, we can't decommit the storage or release the virtual address space,
|
||||
//the best we can do is try to remove some memory from the process working set.
|
||||
//the best we can do is try to remove some memory from the process working set.
|
||||
//With a bit of luck we can free some physical memory.
|
||||
unsigned long old_protect_ignored;
|
||||
bool b_ret = winapi::virtual_unlock(shrink_page_start, shrink_page_bytes)
|
||||
|
||||
@@ -33,12 +33,12 @@ namespace interprocess {
|
||||
/*!This class implements the simple sequential fit algorithm with a simply
|
||||
linked list of free buffers.*/
|
||||
template<class MutexFamily, class VoidPtr>
|
||||
class multi_simple_seq_fit
|
||||
class multi_simple_seq_fit
|
||||
: public ipcdetail::simple_seq_fit_impl<MutexFamily, VoidPtr>
|
||||
{
|
||||
typedef ipcdetail::simple_seq_fit_impl<MutexFamily, VoidPtr> base_t;
|
||||
public:
|
||||
/*!Constructor. "size" is the total size of the managed memory segment,
|
||||
/*!Constructor. "size" is the total size of the managed memory segment,
|
||||
"extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(multi_simple_seq_fit)
|
||||
offset that the allocator should not use at all.*/
|
||||
multi_simple_seq_fit (size_type size, size_type extra_hdr_bytes)
|
||||
|
||||
@@ -84,10 +84,10 @@ class simple_seq_fit_impl
|
||||
{
|
||||
/*!Offset pointer to the next block.*/
|
||||
block_ctrl_ptr m_next;
|
||||
/*!This block's memory size (including block_ctrl
|
||||
/*!This block's memory size (including block_ctrl
|
||||
header) in BasicSize units*/
|
||||
size_type m_size;
|
||||
|
||||
|
||||
size_type get_user_bytes() const
|
||||
{ return this->m_size*Alignment - BlockCtrlBytes; }
|
||||
|
||||
@@ -124,7 +124,7 @@ class simple_seq_fit_impl
|
||||
} m_header;
|
||||
|
||||
public:
|
||||
/*!Constructor. "size" is the total size of the managed memory segment,
|
||||
/*!Constructor. "size" is the total size of the managed memory segment,
|
||||
"extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(simple_seq_fit_impl)
|
||||
offset that the allocator should not use at all.*/
|
||||
simple_seq_fit_impl (size_type size, size_type extra_hdr_bytes);
|
||||
@@ -159,7 +159,7 @@ class simple_seq_fit_impl
|
||||
|
||||
std::pair<void *, bool>
|
||||
allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
|
||||
size_type preferred_size,size_type &received_size,
|
||||
size_type preferred_size,size_type &received_size,
|
||||
void *reuse_ptr = 0, size_type backwards_multiple = 1);
|
||||
|
||||
/*!Returns the size of the buffer previously allocated pointed by ptr*/
|
||||
@@ -170,8 +170,8 @@ class simple_seq_fit_impl
|
||||
void* allocate_aligned (size_type nbytes, size_type alignment);
|
||||
|
||||
/*!Allocates bytes, if there is no more memory, it executes functor
|
||||
f(size_type) to allocate a new segment to manage. The functor returns
|
||||
std::pair<void*, size_type> indicating the base address and size of
|
||||
f(size_type) to allocate a new segment to manage. The functor returns
|
||||
std::pair<void*, size_type> indicating the base address and size of
|
||||
the new segment. If the new segment can't be allocated, allocate
|
||||
it will return 0.*/
|
||||
void* multi_allocate(size_type nbytes);
|
||||
@@ -259,7 +259,7 @@ inline simple_seq_fit_impl<MutexFamily, VoidPointer>::~simple_seq_fit_impl()
|
||||
|
||||
template<class MutexFamily, class VoidPointer>
|
||||
inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::grow(size_type extra_size)
|
||||
{
|
||||
{
|
||||
//Old highest address block's end offset
|
||||
size_type old_end = m_header.m_size/Alignment*Alignment;
|
||||
|
||||
@@ -283,7 +283,7 @@ inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::grow(size_type extra_
|
||||
|
||||
template<class MutexFamily, class VoidPointer>
|
||||
inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_add_segment(void *addr, size_type size)
|
||||
{
|
||||
{
|
||||
//Check size
|
||||
BOOST_ASSERT(!(size < MinBlockSize));
|
||||
if(size < MinBlockSize)
|
||||
@@ -293,7 +293,7 @@ inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_add_segment(void
|
||||
new_block->m_size = size/Alignment;
|
||||
new_block->m_next = 0;
|
||||
//Simulate this block was previously allocated
|
||||
m_header.m_allocated += new_block->m_size*Alignment;
|
||||
m_header.m_allocated += new_block->m_size*Alignment;
|
||||
//Return block and insert it in the free block list
|
||||
this->priv_deallocate(reinterpret_cast<char*>(new_block) + BlockCtrlBytes);
|
||||
}
|
||||
@@ -334,7 +334,7 @@ inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::clear_free_memory()
|
||||
|
||||
//Iterate through all free portions
|
||||
do{
|
||||
//Just clear user the memory part reserved for the user
|
||||
//Just clear user the memory part reserved for the user
|
||||
std::memset( reinterpret_cast<char*>(block) + BlockCtrlBytes
|
||||
, 0
|
||||
, block->m_size*Alignment - BlockCtrlBytes);
|
||||
@@ -381,7 +381,7 @@ inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
template<class MutexFamily, class VoidPointer>
|
||||
inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
allocate(size_type nbytes)
|
||||
{
|
||||
{
|
||||
//-----------------------
|
||||
boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
|
||||
//-----------------------
|
||||
@@ -392,7 +392,7 @@ inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
template<class MutexFamily, class VoidPointer>
|
||||
inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
allocate_aligned(size_type nbytes, size_type alignment)
|
||||
{
|
||||
{
|
||||
//-----------------------
|
||||
boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
|
||||
//-----------------------
|
||||
@@ -402,7 +402,7 @@ inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
template<class MutexFamily, class VoidPointer>
|
||||
inline std::pair<void *, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
allocation_command (boost::interprocess::allocation_type command, size_type min_size,
|
||||
size_type preferred_size,size_type &received_size,
|
||||
size_type preferred_size,size_type &received_size,
|
||||
void *reuse_ptr, size_type backwards_multiple)
|
||||
{
|
||||
//-----------------------
|
||||
@@ -451,11 +451,11 @@ inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
}
|
||||
//Now obtain the polymorphic functor that creates
|
||||
//new segments and try to allocate again.
|
||||
boost::interprocess::multi_segment_services *p_services =
|
||||
boost::interprocess::multi_segment_services *p_services =
|
||||
static_cast<boost::interprocess::multi_segment_services*>
|
||||
(void_pointer::find_group_data(group));
|
||||
BOOST_ASSERT(p_services);
|
||||
std::pair<void *, std::size_t> ret =
|
||||
std::pair<void *, std::size_t> ret =
|
||||
p_services->create_new_segment(MinBlockSize > nbytes ? MinBlockSize : nbytes);
|
||||
if(ret.first){
|
||||
priv_add_segment(ret.first, ret.second);
|
||||
@@ -498,11 +498,11 @@ void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_type needs_backwards =
|
||||
size_type needs_backwards =
|
||||
ipcdetail::get_rounded_size(preferred_size - extra_forward, Alignment);
|
||||
|
||||
|
||||
if(!only_preferred_backwards){
|
||||
needs_backwards =
|
||||
needs_backwards =
|
||||
max_value(ipcdetail::get_rounded_size(min_size - extra_forward, Alignment)
|
||||
,min_value(prev->get_user_bytes(), needs_backwards));
|
||||
}
|
||||
@@ -513,15 +513,15 @@ void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
if(!priv_expand(reuse_ptr, received_size, received_size, received_size)){
|
||||
BOOST_ASSERT(0);
|
||||
}
|
||||
|
||||
|
||||
//We need a minimum size to split the previous one
|
||||
if((prev->get_user_bytes() - needs_backwards) > 2*BlockCtrlBytes){
|
||||
block_ctrl *new_block = reinterpret_cast<block_ctrl *>
|
||||
(reinterpret_cast<char*>(reuse) - needs_backwards - BlockCtrlBytes);
|
||||
new_block->m_next = 0;
|
||||
new_block->m_size =
|
||||
new_block->m_size =
|
||||
BlockCtrlSize + (needs_backwards + extra_forward)/Alignment;
|
||||
prev->m_size =
|
||||
prev->m_size =
|
||||
(prev->get_total_bytes() - needs_backwards)/Alignment - BlockCtrlSize;
|
||||
received_size = needs_backwards + extra_forward;
|
||||
m_header.m_allocated += needs_backwards + BlockCtrlBytes;
|
||||
@@ -553,7 +553,7 @@ std::pair<void *, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
,void *reuse_ptr)
|
||||
{
|
||||
if(command & boost::interprocess::shrink_in_place){
|
||||
bool success =
|
||||
bool success =
|
||||
this->priv_shrink(reuse_ptr, limit_size, preferred_size, received_size);
|
||||
return std::pair<void *, bool> ((success ? reuse_ptr : 0), true);
|
||||
}
|
||||
@@ -643,7 +643,7 @@ inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl *
|
||||
}
|
||||
|
||||
template<class MutexFamily, class VoidPointer>
|
||||
inline
|
||||
inline
|
||||
std::pair<typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl *
|
||||
,typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl *>
|
||||
simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
@@ -724,7 +724,7 @@ inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
//We can fill expand. Merge both blocks,
|
||||
block->m_next = next_block->m_next;
|
||||
block->m_size = merged_size;
|
||||
|
||||
|
||||
//Find the previous free block of next_block
|
||||
block_ctrl *prev = &m_header.m_root;
|
||||
while(ipcdetail::to_raw_pointer(prev->m_next) != next_block){
|
||||
@@ -733,7 +733,7 @@ inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
|
||||
//Now insert merged block in the free list
|
||||
//This allows reusing allocation logic in this function
|
||||
m_header.m_allocated -= old_block_size*Alignment;
|
||||
m_header.m_allocated -= old_block_size*Alignment;
|
||||
prev->m_next = block;
|
||||
|
||||
//Now use check and allocate to do the allocation logic
|
||||
@@ -747,7 +747,7 @@ inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
BOOST_ASSERT(0);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class MutexFamily, class VoidPointer>
|
||||
@@ -805,13 +805,13 @@ inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
|
||||
//Now deallocate the new block to insert it in the free list
|
||||
this->priv_deallocate(reinterpret_cast<char*>(block)+BlockCtrlBytes);
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class MutexFamily, class VoidPointer>
|
||||
inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
priv_allocate_aligned(size_type nbytes, size_type alignment)
|
||||
{
|
||||
{
|
||||
//Ensure power of 2
|
||||
if ((alignment & (alignment - size_type(1u))) != 0){
|
||||
//Alignment is not power of two
|
||||
@@ -823,8 +823,8 @@ inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
if(alignment <= Alignment){
|
||||
return priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
|
||||
}
|
||||
|
||||
size_type request =
|
||||
|
||||
size_type request =
|
||||
nbytes + alignment + MinBlockSize*Alignment - BlockCtrlBytes;
|
||||
void *buffer = priv_allocate(boost::interprocess::allocate_new, request, request, ignore).first;
|
||||
if(!buffer)
|
||||
@@ -835,7 +835,7 @@ inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
|
||||
char *aligned_portion = reinterpret_cast<char*>
|
||||
(reinterpret_cast<size_type>(static_cast<char*>(buffer) + alignment - 1) & -alignment);
|
||||
|
||||
char *pos = ((aligned_portion - reinterpret_cast<char*>(buffer)) >= (MinBlockSize*Alignment)) ?
|
||||
char *pos = ((aligned_portion - reinterpret_cast<char*>(buffer)) >= (MinBlockSize*Alignment)) ?
|
||||
aligned_portion : (aligned_portion + alignment);
|
||||
|
||||
block_ctrl *first = reinterpret_cast<block_ctrl*>
|
||||
@@ -867,7 +867,7 @@ void* simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_check_and_allocate
|
||||
bool found = false;
|
||||
|
||||
if (block->m_size > upper_nunits){
|
||||
//This block is bigger than needed, split it in
|
||||
//This block is bigger than needed, split it in
|
||||
//two blocks, the first's size will be (block->m_size-units)
|
||||
//the second's size (units)
|
||||
size_type total_size = block->m_size;
|
||||
@@ -918,7 +918,7 @@ void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_deallocate(void* addr)
|
||||
|
||||
//Let's get free block list. List is always sorted
|
||||
//by memory address to allow block merging.
|
||||
//Pointer next always points to the first
|
||||
//Pointer next always points to the first
|
||||
//(lower address) block
|
||||
block_ctrl_ptr prev = &m_header.m_root;
|
||||
block_ctrl_ptr pos = m_header.m_root.m_next;
|
||||
@@ -934,9 +934,9 @@ void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_deallocate(void* addr)
|
||||
|
||||
size_type total_size = Alignment*block->m_size;
|
||||
BOOST_ASSERT(m_header.m_allocated >= total_size);
|
||||
|
||||
|
||||
//Update used memory count
|
||||
m_header.m_allocated -= total_size;
|
||||
m_header.m_allocated -= total_size;
|
||||
|
||||
//Let's find the previous and the next block of the block to deallocate
|
||||
//This ordering comparison must be done with original pointers
|
||||
@@ -949,7 +949,7 @@ void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_deallocate(void* addr)
|
||||
|
||||
//Try to combine with upper block
|
||||
if ((reinterpret_cast<char*>(ipcdetail::to_raw_pointer(block))
|
||||
+ Alignment*block->m_size) ==
|
||||
+ Alignment*block->m_size) ==
|
||||
reinterpret_cast<char*>(ipcdetail::to_raw_pointer(pos))){
|
||||
|
||||
block->m_size += pos->m_size;
|
||||
@@ -961,7 +961,7 @@ void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_deallocate(void* addr)
|
||||
|
||||
//Try to combine with lower block
|
||||
if ((reinterpret_cast<char*>(ipcdetail::to_raw_pointer(prev))
|
||||
+ Alignment*prev->m_size) ==
|
||||
+ Alignment*prev->m_size) ==
|
||||
reinterpret_cast<char*>(ipcdetail::to_raw_pointer(block))){
|
||||
prev->m_size += block->m_size;
|
||||
prev->m_next = block->m_next;
|
||||
|
||||
@@ -284,7 +284,7 @@ class offset_ptr
|
||||
template<class T2>
|
||||
offset_ptr( const offset_ptr<T2, DifferenceType, OffsetType, OffsetAlignment> &ptr
|
||||
#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
|
||||
, typename ipcdetail::enable_if_c< ipcdetail::is_convertible<T2*, PointedType*>::value
|
||||
, typename ipcdetail::enable_if_c< ipcdetail::is_convertible<T2*, PointedType*>::value
|
||||
&& ipcdetail::offset_ptr_maintains_address<T2, PointedType>::value
|
||||
>::type * = 0
|
||||
#endif
|
||||
@@ -404,7 +404,7 @@ class offset_ptr
|
||||
|
||||
#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
|
||||
template<class T2>
|
||||
typename ipcdetail::enable_if_c<ipcdetail::is_convertible<T2*, PointedType*>::value
|
||||
typename ipcdetail::enable_if_c<ipcdetail::is_convertible<T2*, PointedType*>::value
|
||||
&& !ipcdetail::offset_ptr_maintains_address<T2, PointedType>::value
|
||||
, offset_ptr&>::type
|
||||
operator= (const offset_ptr<T2, DifferenceType, OffsetType, OffsetAlignment> &ptr)
|
||||
|
||||
@@ -123,7 +123,7 @@ class segment_manager_base
|
||||
/// @cond
|
||||
|
||||
//Experimental. Dont' use.
|
||||
//!Allocates n_elements of elem_bytes bytes.
|
||||
//!Allocates n_elements of elem_bytes bytes.
|
||||
//!Throws bad_alloc on failure. chain.size() is not increased on failure.
|
||||
void allocate_many(size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
|
||||
{
|
||||
@@ -145,7 +145,7 @@ class segment_manager_base
|
||||
}
|
||||
}
|
||||
|
||||
//!Allocates n_elements of elem_bytes bytes.
|
||||
//!Allocates n_elements of elem_bytes bytes.
|
||||
//!Non-throwing version. chain.size() is not increased on failure.
|
||||
void allocate_many(std::nothrow_t, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
|
||||
{ MemoryAlgorithm::allocate_many(elem_bytes, n_elements, chain); }
|
||||
|
||||
@@ -36,7 +36,7 @@ class bad_weak_ptr
|
||||
{ return "boost::interprocess::bad_weak_ptr"; }
|
||||
};
|
||||
|
||||
} // namespace interprocess
|
||||
} // namespace interprocess
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
|
||||
@@ -25,7 +25,7 @@ class internal_mutex_lock
|
||||
public:
|
||||
|
||||
typedef typename Lock::mutex_type::internal_mutex_type mutex_type;
|
||||
|
||||
|
||||
|
||||
internal_mutex_lock(Lock &l)
|
||||
: l_(l)
|
||||
|
||||
@@ -59,7 +59,7 @@ class named_condition;
|
||||
//!
|
||||
//!Unlike std::condition_variable in C++11, it is NOT safe to invoke the destructor if all
|
||||
//!threads have been only notified. It is required that they have exited their respective wait
|
||||
//!functions.
|
||||
//!functions.
|
||||
class interprocess_condition
|
||||
{
|
||||
/// @cond
|
||||
@@ -94,7 +94,7 @@ class interprocess_condition
|
||||
//!this->notify_one() or this->notify_all(), and then reacquires the lock.
|
||||
template <typename L>
|
||||
void wait(L& lock)
|
||||
{
|
||||
{
|
||||
ipcdetail::internal_mutex_lock<L> internal_lock(lock);
|
||||
m_condition.wait(internal_lock);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace interprocess {
|
||||
//!
|
||||
//!Unlike std::condition_variable_any in C++11, it is NOT safe to invoke the destructor if all
|
||||
//!threads have been only notified. It is required that they have exited their respective wait
|
||||
//!functions.
|
||||
//!functions.
|
||||
class interprocess_condition_any
|
||||
{
|
||||
/// @cond
|
||||
@@ -61,7 +61,7 @@ class interprocess_condition_any
|
||||
public:
|
||||
typedef interprocess_condition condvar_type;
|
||||
typedef interprocess_mutex mutex_type;
|
||||
|
||||
|
||||
condvar_type &get_condvar() { return m_cond; }
|
||||
mutex_type &get_mutex() { return m_mut; }
|
||||
|
||||
|
||||
@@ -498,7 +498,7 @@ inline bool interprocess_upgradable_mutex::timed_lock_sharable
|
||||
//or there are too many sharable locks
|
||||
while (this->m_ctrl.exclusive_in
|
||||
|| this->m_ctrl.num_upr_shar == constants::max_readers){
|
||||
if(!this->m_first_gate.timed_wait(lck, abs_time)){
|
||||
if(!this->m_first_gate.timed_wait(lck, abs_time)){
|
||||
if(this->m_ctrl.exclusive_in
|
||||
|| this->m_ctrl.num_upr_shar == constants::max_readers){
|
||||
return false;
|
||||
|
||||
@@ -177,7 +177,7 @@ inline bool named_condition::timed_wait
|
||||
template <typename L, typename Pr>
|
||||
inline bool named_condition::timed_wait
|
||||
(L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
|
||||
{
|
||||
{
|
||||
ipcdetail::internal_mutex_lock<L> internal_lock(lock);
|
||||
return m_cond.timed_wait(internal_lock, abs_time, pred);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ class shm_named_condition
|
||||
public:
|
||||
typedef interprocess_mutex mutex_type;
|
||||
typedef interprocess_condition condvar_type;
|
||||
|
||||
|
||||
condvar_type& get_condvar() { return m_cond; }
|
||||
mutex_type& get_mutex() { return m_mtx; }
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ class shm_named_condition_any
|
||||
public:
|
||||
typedef interprocess_mutex mutex_type;
|
||||
typedef interprocess_condition condvar_type;
|
||||
|
||||
|
||||
condvar_type& get_condvar() { return m_cond; }
|
||||
mutex_type& get_mutex() { return m_mtx; }
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ class winapi_mutex_wrapper
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void close()
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ class xsi_key
|
||||
//!If the shared memory previously exists, throws an error.
|
||||
xsi_key(const char *path, boost::uint8_t id)
|
||||
{
|
||||
key_t key;
|
||||
key_t key;
|
||||
if(path){
|
||||
key = ::ftok(path, id);
|
||||
if(((key_t)-1) == key){
|
||||
|
||||
@@ -8,7 +8,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<meta http-equiv="refresh" content="0; URL=../../doc/html/interprocess.html">
|
||||
</head>
|
||||
<body>
|
||||
Automatic redirection failed, please go to
|
||||
Automatic redirection failed, please go to
|
||||
<a href="../../doc/html/interprocess.html">../../doc/html/interprocess.html</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -164,7 +164,7 @@ LOCK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
UNLOCK
|
||||
if (fixing_mode){
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace test{
|
||||
template< class T1, class T2>
|
||||
bool CheckEqual( const T1 &t1, const T2 &t2
|
||||
, typename boost::container::container_detail::enable_if_c
|
||||
<!boost::container::container_detail::is_pair<T1>::value &&
|
||||
<!boost::container::container_detail::is_pair<T1>::value &&
|
||||
!boost::container::container_detail::is_pair<T2>::value
|
||||
>::type* = 0)
|
||||
{ return t1 == t2; }
|
||||
@@ -32,7 +32,7 @@ bool CheckEqual( const T1 &t1, const T2 &t2
|
||||
template< class Pair1, class Pair2>
|
||||
bool CheckEqual( const Pair1 &pair1, const Pair2 &pair2
|
||||
, typename boost::container::container_detail::enable_if_c
|
||||
<boost::container::container_detail::is_pair<Pair1>::value &&
|
||||
<boost::container::container_detail::is_pair<Pair1>::value &&
|
||||
boost::container::container_detail::is_pair<Pair2>::value
|
||||
>::type* = 0)
|
||||
{
|
||||
|
||||
@@ -281,7 +281,7 @@ static boost::interprocess::message_queue *global_queue = 0;
|
||||
static const int MULTI_NUM_MSG_PER_SENDER = 10000;
|
||||
//Message queue message capacity
|
||||
static const int MULTI_QUEUE_SIZE = (MULTI_NUM_MSG_PER_SENDER - 1)/MULTI_NUM_MSG_PER_SENDER + 1;
|
||||
//We'll launch MULTI_THREAD_COUNT senders and MULTI_THREAD_COUNT receivers
|
||||
//We'll launch MULTI_THREAD_COUNT senders and MULTI_THREAD_COUNT receivers
|
||||
static const int MULTI_THREAD_COUNT = 10;
|
||||
|
||||
static void multisend()
|
||||
|
||||
@@ -115,7 +115,7 @@ class movable_and_copyable_int
|
||||
movable_and_copyable_int(const movable_and_copyable_int& mmi)
|
||||
: m_int(mmi.m_int)
|
||||
{}
|
||||
|
||||
|
||||
movable_and_copyable_int(BOOST_RV_REF(movable_and_copyable_int) mmi)
|
||||
: m_int(mmi.m_int)
|
||||
{ mmi.m_int = 0; }
|
||||
@@ -189,7 +189,7 @@ class copyable_int
|
||||
copyable_int(const copyable_int& mmi)
|
||||
: m_int(mmi.m_int)
|
||||
{}
|
||||
|
||||
|
||||
copyable_int & operator= (int i)
|
||||
{ this->m_int = i; return *this; }
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ void test_mutex_lock()
|
||||
boost::interprocess::ipcdetail::thread_launch(tm2, thread_adapter<M>(&lock_and_sleep, &d2, mtx));
|
||||
|
||||
//Wait completion
|
||||
|
||||
|
||||
boost::interprocess::ipcdetail::thread_join(tm1);
|
||||
boost::interprocess::ipcdetail::thread_sleep((1000*1*BaseSeconds));
|
||||
boost::interprocess::ipcdetail::thread_join(tm2);
|
||||
|
||||
@@ -328,10 +328,10 @@ int main()
|
||||
using namespace boost::interprocess;
|
||||
typedef allocator<double, managed_shared_memory::segment_manager> alloc_t;
|
||||
|
||||
std::size_t n = 0x1 << 26;
|
||||
std::size_t n = 0x1 << 26;
|
||||
std::size_t file_size = n * sizeof(double) + 1000000;
|
||||
|
||||
{
|
||||
{
|
||||
shared_memory_object::remove("MyMappedFile");
|
||||
managed_shared_memory segment(open_or_create, "MyMappedFile", file_size);
|
||||
shared_memory_object::remove("MyMappedFile");
|
||||
|
||||
Reference in New Issue
Block a user