-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2205] Use shared memory to share number of upload threads
- Loading branch information
1 parent
85c6438
commit afc64c1
Showing
5 changed files
with
322 additions
and
186 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
s3_resource/include/irods/private/s3_resource/multipart_shared_data.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#ifndef IRODS_S3_RESOURCE_MULTIPART_SHARED_DATA_HPP | ||
#define IRODS_S3_RESOURCE_MULTIPART_SHARED_DATA_HPP | ||
|
||
#include <boost/interprocess/managed_shared_memory.hpp> | ||
#include <boost/interprocess/containers/map.hpp> | ||
#include <boost/interprocess/containers/vector.hpp> | ||
#include <boost/interprocess/containers/list.hpp> | ||
#include <boost/interprocess/allocators/allocator.hpp> | ||
#include <boost/interprocess/managed_shared_memory.hpp> | ||
#include <boost/interprocess/containers/string.hpp> | ||
#include <boost/interprocess/sync/named_mutex.hpp> | ||
#include <boost/container/scoped_allocator.hpp> | ||
#include <boost/interprocess/sync/scoped_lock.hpp> | ||
|
||
#include <iostream> | ||
|
||
namespace irods_s3 | ||
{ | ||
namespace interprocess_types | ||
{ | ||
namespace bi = boost::interprocess; | ||
using segment_manager = bi::managed_shared_memory::segment_manager; | ||
using void_allocator = boost::container::scoped_allocator_adaptor<bi::allocator<void, segment_manager> >; | ||
} | ||
|
||
// data that needs to be shared among different processes | ||
struct multipart_shared_data | ||
{ | ||
explicit multipart_shared_data(const interprocess_types::void_allocator &allocator) | ||
: threads_remaining_to_close{0} | ||
, number_of_threads{0} | ||
, ref_count{0} | ||
{} | ||
|
||
bool can_delete() { | ||
return threads_remaining_to_close == 0; | ||
} | ||
|
||
int threads_remaining_to_close; | ||
int number_of_threads; | ||
int ref_count; | ||
}; // struct multipart_shared_data | ||
} // namespace irods_s3 | ||
|
||
#endif // IRODS_S3_RESOURCE_MULTIPART_SHARED_DATA_HPP |
Oops, something went wrong.