Replace BOOST_TRY/CATCH family macros with BOOST_INTERPROCESS_TRY/CATCH

This commit is contained in:
Ion Gaztañaga
2024-08-03 22:37:11 +02:00
parent 1e28228d9c
commit 865573a821
11 changed files with 44 additions and 43 deletions

View File

@@ -43,7 +43,7 @@ int main ()
const std::size_t FileSize = 1000;
file_mapping::remove(FileName);
BOOST_TRY{
BOOST_INTERPROCESS_TRY{
MyList::size_type old_size = 0;
managed_mapped_file::handle_t list_handle;
{
@@ -55,14 +55,14 @@ int main ()
list_handle = mfile_memory.get_handle_from_address(mylist);
//Fill list until there is no more room in the file
BOOST_TRY{
BOOST_INTERPROCESS_TRY{
while(1) {
mylist->insert(mylist->begin(), 0);
}
}
BOOST_CATCH(const bad_alloc &){
BOOST_INTERPROCESS_CATCH(const bad_alloc &){
//mapped file is full
} BOOST_CATCH_END
} BOOST_INTERPROCESS_CATCH_END
//Let's obtain the size of the list
old_size = mylist->size();
}
@@ -80,14 +80,14 @@ int main ()
(mfile_memory.get_address_from_handle(list_handle));
//Fill list until there is no more room in the file
BOOST_TRY{
BOOST_INTERPROCESS_TRY{
while(1) {
mylist->insert(mylist->begin(), 0);
}
}
BOOST_CATCH(const bad_alloc &){
BOOST_INTERPROCESS_CATCH(const bad_alloc &){
//mapped file is full
} BOOST_CATCH_END
} BOOST_INTERPROCESS_CATCH_END
//Let's obtain the new size of the list
MyList::size_type new_size = mylist->size();
@@ -98,10 +98,10 @@ int main ()
return (new_size > old_size) ? 0 : 1;
}
}
BOOST_CATCH(...){
BOOST_INTERPROCESS_CATCH(...){
file_mapping::remove(FileName);
BOOST_RETHROW
} BOOST_CATCH_END
BOOST_INTERPROCESS_RETHROW
} BOOST_INTERPROCESS_CATCH_END
file_mapping::remove(FileName);
return 0;
}