Commit 800ec8fc authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Prepare for more smart pointers: shared_ptr instead of unique_ptr.

parent 9e495fe1
......@@ -256,7 +256,7 @@ LocalFileLinux::xx_readv(const ReadList& requests, bool parallel_ok, bool immuta
// terms of the other is an implementation detail.
if (!parallel_ok || requests.size() < 2) {
for (const ReadRequest& r : requests) {
std::unique_ptr<char[]> data(new char[r.size]);
std::shared_ptr<char> data(new char[r.size]);
this->LocalFileLinux::xx_read(data.get(), r.offset, r.size, usagehint);
r.delivery(data.get(), r.size);
}
......@@ -292,7 +292,7 @@ LocalFileLinux::xx_readv(const ReadList& requests, bool parallel_ok, bool immuta
MTGuard guard;
#pragma omp parallel num_threads(threadcount)
{
std::unique_ptr<char[]> data(new char[maxsize]);
std::shared_ptr<char> data(new char[maxsize]);
#pragma omp for
for (std::int64_t ii=0; ii<requestcount; ++ii) {
const ReadRequest& r = requests[ii];
......
......@@ -1153,7 +1153,7 @@ SeismicStoreFile::xx_readv(const ReadList& requests, bool parallel_ok, bool immu
#if 0
// For now just implement xx_readv in terms of xx_read.
for (const ReadRequest& r : requests) {
std::unique_ptr<char[]> data(new char[r.size]);
std::shared_ptr<char> data(new char[r.size]);
this->SeismicStoreFile::xx_read(data.get(), r.offset, r.size, usagehint);
r.delivery(data.get(), r.size);
}
......@@ -1220,7 +1220,7 @@ SeismicStoreFile::xx_readv(const ReadList& requests, bool parallel_ok, bool immu
return std::max(a, b.local_size + b.outpos);
});
std::unique_ptr<char[]> data(new char[realsize]);
std::shared_ptr<char> data(new char[realsize]);
if (this->_config->_debug_trace)
this->_config->_debug_trace("readv", /*need=*/asked, /*want=*/realsize,/*parts*/ work.size(), this->_dataset->info()->allSizes(-1));
......@@ -1808,7 +1808,7 @@ SeismicStoreFileDelayedWrite::xx_readv(const ReadList& requests, bool parallel_o
// of xx_read() or vice versa. Because this is an implementation
// detail and overriding one of them should not affect the other.
for (const ReadRequest& r : requests) {
std::unique_ptr<char> data(new char[r.size]);
std::shared_ptr<char> data(new char[r.size]);
this->SeismicStoreFileDelayedWrite::xx_read(data.get(), r.offset, r.size, usagehint);
r.delivery(data.get(), r.size);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment