Archive Component - Rewrite and additional work on Archive and Asset Bundler (#4332)
* Fix issues with seedlist for AutomatedTesting Fixes error reporting so it will show the file hint in the tool. Removes any missing assets from the .seed file. Remove an unnecessary dependency from AutomatedTesting dependencies file. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Make ArchiveComponent use AZ::IO::IArchive Initial changes that will get the sychronous calls in ArchiveComponent to use IArchive interface rather than external zip/7z tools. Some of the asynchronous api are still in place, anything that wasn't being used has been removed for now. This may change later if we move towards all the api being asynchronous. Until then, we can't remove the reliance upon the external archive tools completely. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Updates AZStd::thread constructors Adds a variadic constructor which forwards args to the functor. Because of our thread_desc extension, there was confusion on the arugments, so the args were reordered to take the thread_desc first, before the functor and args. Also the thread_desc is taken as reference rather than by pointer. Update callsites to account for this change. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Async operation of ArchiveComponent api This sets up the ArchiveComponent to operate asynchronously. It uses promise/future to transfer results to caller. This is still broken, there's a few things that need to get fixed up, but this is a good checkpoint for the work as it solidifies the api, cleans up a bunch of unused code, and compiles. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Removes the platform-specific ArchiveComponen These are no longer needed, as they control the direct interaction with host OS tools like 7za.exe or /bin/zip. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Removes the platform-specific files from cmake Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Removes the 7za.exe (and legal notice) This tool is no longer needed in the repo. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Fixes usage of IArchive::GetFullPath() This changed to return a PathView, updated to reflect that. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Fix promises and threads Make sure promises are only set exactly once. This meant reworking some of the initial error checking. Detach threads when created. Adds [[nodiscard]] to the functions that return a future. Since threads are detached, the future is the main way to get communication from the thread. Clean up interface, add comments. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * More edits to thread creation Changes to thread construction to account for parameter change. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Fix some remaining issues with ArchiveComponent Put created threads inside a container, then join them at Deactivate. Fix asset bundler case when injecting a file with no working directory. Fix thread constructor that applies args to a function. Fix lambdas to take string args by value rather than reference. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Fixes some remaining bugs in ArchiveComponent Open archive as read-only during extract & list operations. Fixes paths issues. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Fix initialize of opaque thread handle in thread_UnixLike.h Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Removed unused variable in AssetBundleComponent.cpp to fix compiler warning Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Fix some issues with archives File paths in the CDR and the local headers need to match, but there were issues with path separators and case that made it possible to get invalid headers errors in some archives. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Adds some new ArchiveComponent unit tests Adds new tests for extraction of archive and adding files from a file list to an archive. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Fix file data offset issues when opening archives When opening an INestedArchive it would run through the CDR headers to create file entries in the zip cache. The offsets to the compressed data were being calculated incorrectly because they were using the CDR headers rather than jumping to the local file headers and getting offsets from those sizes. Removed and refactored some archive validation flow and zip cache factory init methods to either init default or init w/ additional validation checks. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Addresses PR feedback Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Address more points of feedback in PR Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Address additional PR feedback Fixes up some error checks and uses of strings vs paths. Enable archive component tests on Linux so we can see if they will pass. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Address PR feedback Change the INestedArchive interface to list files as AZ::IO::Path. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Disabling the ArchiveComponent tests on Linux They failed so we will revisit them to attempt a fix. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Rename a member variable to be more accurate Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Address feedback on PR Bump version of Archive Components for serialize context. Improve error messages during archive open and validation. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Revert recent changes Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
@@ -43,10 +43,12 @@ namespace AZ::IO
|
||||
|
||||
m_mainLoopDesc = threadDesc;
|
||||
m_mainLoopDesc.m_name = "IO Scheduler";
|
||||
m_mainLoop = AZStd::thread([this]()
|
||||
{
|
||||
Thread_MainLoop();
|
||||
}, &m_mainLoopDesc);
|
||||
m_mainLoop = AZStd::thread(
|
||||
m_mainLoopDesc,
|
||||
[this]()
|
||||
{
|
||||
Thread_MainLoop();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -644,11 +644,11 @@ JobManagerWorkStealing::ThreadList JobManagerWorkStealing::CreateWorkerThreads(c
|
||||
}
|
||||
|
||||
info->m_thread = AZStd::thread(
|
||||
threadDesc,
|
||||
[this, info]()
|
||||
{
|
||||
this->ProcessJobsWorker(info);
|
||||
},
|
||||
&threadDesc
|
||||
}
|
||||
);
|
||||
|
||||
info->m_threadId = info->m_thread.get_id();
|
||||
|
||||
@@ -205,13 +205,13 @@ namespace AZ
|
||||
}
|
||||
m_active.store(true, AZStd::memory_order_release);
|
||||
|
||||
m_thread = AZStd::thread{ [this, &initSemaphore]
|
||||
m_thread = AZStd::thread{ desc,
|
||||
[this, &initSemaphore]
|
||||
{
|
||||
t_worker = this;
|
||||
initSemaphore.release();
|
||||
Run();
|
||||
},
|
||||
&desc };
|
||||
} };
|
||||
}
|
||||
|
||||
// Threads that wait on a graph to complete are disqualified from receiving tasks until the wait finishes
|
||||
|
||||
@@ -87,12 +87,6 @@ namespace AZStd
|
||||
|
||||
// construct/copy/destroy:
|
||||
thread();
|
||||
/**
|
||||
* \note thread_desc is AZStd extension.
|
||||
*/
|
||||
template <class F>
|
||||
explicit thread(F&& f, const thread_desc* desc = 0);
|
||||
|
||||
~thread();
|
||||
|
||||
thread(thread&& rhs)
|
||||
@@ -108,6 +102,15 @@ namespace AZStd
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class F, class... Args, typename = AZStd::enable_if_t<!AZStd::is_convertible_v<AZStd::decay_t<F>, thread_desc>>>
|
||||
explicit thread(F&& f, Args&&... args);
|
||||
|
||||
/**
|
||||
* \note thread_desc is AZStd extension.
|
||||
*/
|
||||
template<class F, class... Args>
|
||||
thread(const thread_desc& desc, F&& f, Args&&... args);
|
||||
|
||||
// Till we fully have RVALUES
|
||||
template <class F>
|
||||
explicit thread(Internal::thread_move_t<F> f);
|
||||
@@ -138,8 +141,8 @@ namespace AZStd
|
||||
//thread(AZStd::delegate<void ()> d,const thread_desc* desc = 0);
|
||||
|
||||
private:
|
||||
thread(thread&);
|
||||
thread& operator=(thread&);
|
||||
thread(const thread&) = delete;
|
||||
thread& operator=(const thread&) = delete;
|
||||
|
||||
native_thread_data_type m_thread;
|
||||
};
|
||||
|
||||
+15
-5
@@ -10,6 +10,8 @@
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
|
||||
#include <AzCore/std/tuple.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
namespace Internal
|
||||
@@ -22,12 +24,20 @@ namespace AZStd
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// thread
|
||||
template <class F>
|
||||
inline thread::thread(F&& f, const thread_desc* desc)
|
||||
template<class F, class... Args, typename>
|
||||
thread::thread(F&& f, Args&&... args)
|
||||
: thread(thread_desc{}, AZStd::forward<F>(f), AZStd::forward<Args>(args)...)
|
||||
{}
|
||||
|
||||
template<class F, class... Args>
|
||||
thread::thread(const thread_desc& desc, F&& f, Args&&... args)
|
||||
{
|
||||
Internal::thread_info* ti = Internal::create_thread_info(AZStd::forward<F>(f));
|
||||
ti->m_name = desc ? desc->m_name : nullptr;
|
||||
m_thread = Internal::create_thread(desc, ti);
|
||||
auto threadfunc = [fn = AZStd::forward<F>(f), argsTuple = AZStd::make_tuple(AZStd::forward<Args>(args)...)]() mutable -> void
|
||||
{
|
||||
AZStd::apply(AZStd::move(fn), AZStd::move(argsTuple));
|
||||
};
|
||||
Internal::thread_info* ti = Internal::create_thread_info(AZStd::move(threadfunc));
|
||||
m_thread = Internal::create_thread(&desc, ti);
|
||||
}
|
||||
|
||||
inline bool thread::joinable() const
|
||||
|
||||
+15
-4
@@ -18,6 +18,8 @@ extern "C"
|
||||
AZ_DLL_IMPORT unsigned long __stdcall GetCurrentThreadId(void);
|
||||
}
|
||||
|
||||
#include <AzCore/std/tuple.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
namespace Internal
|
||||
@@ -30,11 +32,20 @@ namespace AZStd
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// thread
|
||||
template <class F>
|
||||
inline thread::thread(F&& f, const thread_desc* desc)
|
||||
template<class F, class... Args, typename>
|
||||
thread::thread(F&& f, Args&&... args)
|
||||
: thread(thread_desc{}, AZStd::forward<F>(f), AZStd::forward<Args>(args)...)
|
||||
{}
|
||||
|
||||
template<class F, class... Args>
|
||||
thread::thread(const thread_desc& desc, F&& f, Args&&... args)
|
||||
{
|
||||
Internal::thread_info* ti = Internal::create_thread_info(AZStd::forward<F>(f));
|
||||
m_thread.m_handle = Internal::create_thread(desc, ti, &m_thread.m_id);
|
||||
auto threadfunc = [fn = AZStd::forward<F>(f), argsTuple = AZStd::make_tuple(AZStd::forward<Args>(args)...)]() mutable -> void
|
||||
{
|
||||
AZStd::apply(AZStd::move(fn), AZStd::move(argsTuple));
|
||||
};
|
||||
Internal::thread_info* ti = Internal::create_thread_info(AZStd::move(threadfunc));
|
||||
m_thread.m_handle = Internal::create_thread(&desc, ti, &m_thread.m_id);
|
||||
}
|
||||
|
||||
inline bool thread::joinable() const
|
||||
|
||||
@@ -195,18 +195,18 @@ namespace UnitTest
|
||||
|
||||
void test_thread_id_for_running_thread_is_not_default_constructed_id()
|
||||
{
|
||||
const thread_desc* desc = m_numThreadDesc ? &m_desc[0] : nullptr;
|
||||
AZStd::thread t(AZStd::bind(&Parallel_Thread::do_nothing, this), desc);
|
||||
const thread_desc desc = m_numThreadDesc ? m_desc[0] : thread_desc{};
|
||||
AZStd::thread t(desc, AZStd::bind(&Parallel_Thread::do_nothing, this));
|
||||
AZ_TEST_ASSERT(t.get_id() != AZStd::thread::id());
|
||||
t.join();
|
||||
}
|
||||
|
||||
void test_different_threads_have_different_ids()
|
||||
{
|
||||
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
|
||||
const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : nullptr;
|
||||
AZStd::thread t(AZStd::bind(&Parallel_Thread::do_nothing, this), desc1);
|
||||
AZStd::thread t2(AZStd::bind(&Parallel_Thread::do_nothing, this), desc2);
|
||||
const thread_desc desc1 = m_numThreadDesc ? m_desc[0] : thread_desc{};
|
||||
const thread_desc desc2 = m_numThreadDesc ? m_desc[1] : thread_desc{};
|
||||
AZStd::thread t(desc1, AZStd::bind(&Parallel_Thread::do_nothing, this));
|
||||
AZStd::thread t2(desc2, AZStd::bind(&Parallel_Thread::do_nothing, this));
|
||||
AZ_TEST_ASSERT(t.get_id() != t2.get_id());
|
||||
t.join();
|
||||
t2.join();
|
||||
@@ -214,13 +214,13 @@ namespace UnitTest
|
||||
|
||||
void test_thread_ids_have_a_total_order()
|
||||
{
|
||||
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
|
||||
const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : nullptr;
|
||||
const thread_desc* desc3 = m_numThreadDesc ? &m_desc[2] : nullptr;
|
||||
const thread_desc desc1 = m_numThreadDesc ? m_desc[0] : thread_desc{};
|
||||
const thread_desc desc2 = m_numThreadDesc ? m_desc[1] : thread_desc{};
|
||||
const thread_desc desc3 = m_numThreadDesc ? m_desc[2] : thread_desc{};
|
||||
|
||||
AZStd::thread t(AZStd::bind(&Parallel_Thread::do_nothing, this), desc1);
|
||||
AZStd::thread t2(AZStd::bind(&Parallel_Thread::do_nothing, this), desc2);
|
||||
AZStd::thread t3(AZStd::bind(&Parallel_Thread::do_nothing, this), desc3);
|
||||
AZStd::thread t(desc1, AZStd::bind(&Parallel_Thread::do_nothing, this));
|
||||
AZStd::thread t2(desc2, AZStd::bind(&Parallel_Thread::do_nothing, this));
|
||||
AZStd::thread t3(desc3, AZStd::bind(&Parallel_Thread::do_nothing, this));
|
||||
AZ_TEST_ASSERT(t.get_id() != t2.get_id());
|
||||
AZ_TEST_ASSERT(t.get_id() != t3.get_id());
|
||||
AZ_TEST_ASSERT(t2.get_id() != t3.get_id());
|
||||
@@ -313,10 +313,10 @@ namespace UnitTest
|
||||
|
||||
void test_thread_id_of_running_thread_returned_by_this_thread_get_id()
|
||||
{
|
||||
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
|
||||
const thread_desc desc1 = m_numThreadDesc ? m_desc[0] : thread_desc{};
|
||||
|
||||
AZStd::thread::id id;
|
||||
AZStd::thread t(AZStd::bind(&Parallel_Thread::get_thread_id, this, &id), desc1);
|
||||
AZStd::thread t(desc1, AZStd::bind(&Parallel_Thread::get_thread_id, this, &id));
|
||||
AZStd::thread::id t_id = t.get_id();
|
||||
t.join();
|
||||
AZ_TEST_ASSERT(id == t_id);
|
||||
@@ -366,10 +366,10 @@ namespace UnitTest
|
||||
|
||||
void test_move_on_construction()
|
||||
{
|
||||
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
|
||||
const thread_desc desc1 = m_numThreadDesc ? m_desc[0] : thread_desc{};
|
||||
AZStd::thread::id the_id;
|
||||
AZStd::thread x;
|
||||
x = AZStd::thread(AZStd::bind(&Parallel_Thread::do_nothing_id, this, &the_id), desc1);
|
||||
x = AZStd::thread(desc1, AZStd::bind(&Parallel_Thread::do_nothing_id, this, &the_id));
|
||||
AZStd::thread::id x_id = x.get_id();
|
||||
x.join();
|
||||
AZ_TEST_ASSERT(the_id == x_id);
|
||||
@@ -377,8 +377,8 @@ namespace UnitTest
|
||||
|
||||
AZStd::thread make_thread(AZStd::thread::id* the_id)
|
||||
{
|
||||
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
|
||||
return AZStd::thread(AZStd::bind(&Parallel_Thread::do_nothing_id, this, the_id), desc1);
|
||||
const thread_desc desc1 = m_numThreadDesc ? m_desc[0] : thread_desc{};
|
||||
return AZStd::thread(desc1, AZStd::bind(&Parallel_Thread::do_nothing_id, this, the_id));
|
||||
}
|
||||
|
||||
void test_move_from_function_return()
|
||||
@@ -430,9 +430,9 @@ namespace UnitTest
|
||||
|
||||
void do_test_creation()
|
||||
{
|
||||
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
|
||||
const thread_desc desc1 = m_numThreadDesc ? m_desc[0] : thread_desc{};
|
||||
m_data = 0;
|
||||
AZStd::thread t(AZStd::bind(&Parallel_Thread::simple_thread, this), desc1);
|
||||
AZStd::thread t(desc1, AZStd::bind(&Parallel_Thread::simple_thread, this));
|
||||
t.join();
|
||||
AZ_TEST_ASSERT(m_data == 999);
|
||||
}
|
||||
@@ -445,9 +445,9 @@ namespace UnitTest
|
||||
|
||||
void do_test_id_comparison()
|
||||
{
|
||||
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
|
||||
const thread_desc desc1 = m_numThreadDesc ? m_desc[0] : thread_desc{};
|
||||
AZStd::thread::id self = this_thread::get_id();
|
||||
AZStd::thread thrd(AZStd::bind(&Parallel_Thread::comparison_thread, this, self), desc1);
|
||||
AZStd::thread thrd(desc1, AZStd::bind(&Parallel_Thread::comparison_thread, this, self));
|
||||
thrd.join();
|
||||
}
|
||||
|
||||
@@ -476,10 +476,10 @@ namespace UnitTest
|
||||
|
||||
void do_test_creation_through_reference_wrapper()
|
||||
{
|
||||
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
|
||||
const thread_desc desc1 = m_numThreadDesc ? m_desc[0] : thread_desc{};
|
||||
non_copyable_functor f;
|
||||
|
||||
AZStd::thread thrd(AZStd::ref(f), desc1);
|
||||
AZStd::thread thrd(desc1, AZStd::ref(f));
|
||||
thrd.join();
|
||||
AZ_TEST_ASSERT(f.value == 999);
|
||||
}
|
||||
@@ -491,10 +491,10 @@ namespace UnitTest
|
||||
|
||||
void test_swap()
|
||||
{
|
||||
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
|
||||
const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : nullptr;
|
||||
AZStd::thread t(AZStd::bind(&Parallel_Thread::simple_thread, this), desc1);
|
||||
AZStd::thread t2(AZStd::bind(&Parallel_Thread::simple_thread, this), desc2);
|
||||
const thread_desc desc1 = m_numThreadDesc ? m_desc[0] : thread_desc{};
|
||||
const thread_desc desc2 = m_numThreadDesc ? m_desc[1] : thread_desc{};
|
||||
AZStd::thread t(desc1, AZStd::bind(&Parallel_Thread::simple_thread, this));
|
||||
AZStd::thread t2(desc2, AZStd::bind(&Parallel_Thread::simple_thread, this));
|
||||
AZStd::thread::id id1 = t.get_id();
|
||||
AZStd::thread::id id2 = t2.get_id();
|
||||
|
||||
@@ -512,7 +512,7 @@ namespace UnitTest
|
||||
|
||||
void run()
|
||||
{
|
||||
const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr;
|
||||
const thread_desc desc1 = m_numThreadDesc ? m_desc[0] : thread_desc{};
|
||||
|
||||
// We need to have at least one processor
|
||||
AZ_TEST_ASSERT(AZStd::thread::hardware_concurrency() >= 1);
|
||||
@@ -520,18 +520,18 @@ namespace UnitTest
|
||||
// Create thread to increment data till we need to
|
||||
m_data = 0;
|
||||
m_dataMax = 10;
|
||||
AZStd::thread tr(AZStd::bind(&Parallel_Thread::increment_data, this), desc1);
|
||||
AZStd::thread tr(desc1, AZStd::bind(&Parallel_Thread::increment_data, this));
|
||||
tr.join();
|
||||
AZ_TEST_ASSERT(m_data == m_dataMax);
|
||||
|
||||
m_data = 0;
|
||||
AZStd::thread trDel(make_delegate(this, &Parallel_Thread::increment_data), desc1);
|
||||
AZStd::thread trDel(desc1, make_delegate(this, &Parallel_Thread::increment_data));
|
||||
trDel.join();
|
||||
AZ_TEST_ASSERT(m_data == m_dataMax);
|
||||
|
||||
chrono::system_clock::time_point startTime = chrono::system_clock::now();
|
||||
{
|
||||
AZStd::thread tr1(AZStd::bind(&Parallel_Thread::sleep_thread, this, chrono::milliseconds(100)), desc1);
|
||||
AZStd::thread tr1(desc1, AZStd::bind(&Parallel_Thread::sleep_thread, this, chrono::milliseconds(100)));
|
||||
tr1.join();
|
||||
}
|
||||
auto sleepTime = chrono::system_clock::now() - startTime;
|
||||
@@ -563,71 +563,71 @@ namespace UnitTest
|
||||
{
|
||||
MfTest x;
|
||||
AZStd::function<void ()> func = AZStd::bind(&MfTest::f0, &x);
|
||||
AZStd::thread(func, desc1).join();
|
||||
AZStd::thread(desc1, func).join();
|
||||
func = AZStd::bind(&MfTest::f0, AZStd::ref(x));
|
||||
AZStd::thread(func, desc1).join();
|
||||
AZStd::thread(desc1, func).join();
|
||||
func = AZStd::bind(&MfTest::g0, &x);
|
||||
AZStd::thread(func, desc1).join();
|
||||
AZStd::thread(desc1, func).join();
|
||||
func = AZStd::bind(&MfTest::g0, x);
|
||||
AZStd::thread(func, desc1).join();
|
||||
AZStd::thread(desc1, func).join();
|
||||
func = AZStd::bind(&MfTest::g0, AZStd::ref(x));
|
||||
AZStd::thread(func, desc1).join();
|
||||
AZStd::thread(desc1, func).join();
|
||||
|
||||
//// 1
|
||||
//thread( AZStd::bind(&MfTest::f1, &x, 1) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::f1, AZStd::ref(x), 1) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g1, &x, 1) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g1, x, 1) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g1, AZStd::ref(x), 1) , desc1).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f1, &x, 1)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f1, AZStd::ref(x), 1)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g1, &x, 1)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g1, x, 1)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g1, AZStd::ref(x), 1)).join();
|
||||
|
||||
//// 2
|
||||
//thread( AZStd::bind(&MfTest::f2, &x, 1, 2) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::f2, AZStd::ref(x), 1, 2) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g2, &x, 1, 2) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g2, x, 1, 2) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g2, AZStd::ref(x), 1, 2) , desc1).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f2, &x, 1, 2)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f2, AZStd::ref(x), 1, 2)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g2, &x, 1, 2)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g2, x, 1, 2)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g2, AZStd::ref(x), 1, 2)).join();
|
||||
|
||||
//// 3
|
||||
//thread( AZStd::bind(&MfTest::f3, &x, 1, 2, 3) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::f3, AZStd::ref(x), 1, 2, 3) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g3, &x, 1, 2, 3) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g3, x, 1, 2, 3) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g3, AZStd::ref(x), 1, 2, 3) , desc1).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f3, &x, 1, 2, 3)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f3, AZStd::ref(x), 1, 2, 3)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g3, &x, 1, 2, 3)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g3, x, 1, 2, 3)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g3, AZStd::ref(x), 1, 2, 3)).join();
|
||||
|
||||
//// 4
|
||||
//thread( AZStd::bind(&MfTest::f4, &x, 1, 2, 3, 4) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::f4, AZStd::ref(x), 1, 2, 3, 4) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g4, &x, 1, 2, 3, 4) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g4, x, 1, 2, 3, 4) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g4, AZStd::ref(x), 1, 2, 3, 4) , desc1).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f4, &x, 1, 2, 3, 4)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f4, AZStd::ref(x), 1, 2, 3, 4)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g4, &x, 1, 2, 3, 4)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g4, x, 1, 2, 3, 4)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g4, AZStd::ref(x), 1, 2, 3, 4)).join();
|
||||
|
||||
//// 5
|
||||
//thread( AZStd::bind(&MfTest::f5, &x, 1, 2, 3, 4, 5) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::f5, AZStd::ref(x), 1, 2, 3, 4, 5) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g5, &x, 1, 2, 3, 4, 5) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g5, x, 1, 2, 3, 4, 5) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g5, AZStd::ref(x), 1, 2, 3, 4, 5) , desc1).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f5, &x, 1, 2, 3, 4, 5)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f5, AZStd::ref(x), 1, 2, 3, 4, 5)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g5, &x, 1, 2, 3, 4, 5)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g5, x, 1, 2, 3, 4, 5)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g5, AZStd::ref(x), 1, 2, 3, 4, 5)).join();
|
||||
|
||||
//// 6
|
||||
//thread( AZStd::bind(&MfTest::f6, &x, 1, 2, 3, 4, 5, 6) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::f6, AZStd::ref(x), 1, 2, 3, 4, 5, 6) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g6, &x, 1, 2, 3, 4, 5, 6) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g6, x, 1, 2, 3, 4, 5, 6) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g6, AZStd::ref(x), 1, 2, 3, 4, 5, 6) , desc1).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f6, &x, 1, 2, 3, 4, 5, 6)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f6, AZStd::ref(x), 1, 2, 3, 4, 5, 6)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g6, &x, 1, 2, 3, 4, 5, 6)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g6, x, 1, 2, 3, 4, 5, 6)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g6, AZStd::ref(x), 1, 2, 3, 4, 5, 6)).join();
|
||||
|
||||
//// 7
|
||||
//thread( AZStd::bind(&MfTest::f7, &x, 1, 2, 3, 4, 5, 6, 7), desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::f7, AZStd::ref(x), 1, 2, 3, 4, 5, 6, 7), desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g7, &x, 1, 2, 3, 4, 5, 6, 7), desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g7, x, 1, 2, 3, 4, 5, 6, 7), desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g7, AZStd::ref(x), 1, 2, 3, 4, 5, 6, 7), desc1).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f7, &x, 1, 2, 3, 4, 5, 6, 7)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f7, AZStd::ref(x), 1, 2, 3, 4, 5, 6, 7)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g7, &x, 1, 2, 3, 4, 5, 6, 7)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g7, x, 1, 2, 3, 4, 5, 6, 7)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g7, AZStd::ref(x), 1, 2, 3, 4, 5, 6, 7)).join();
|
||||
|
||||
//// 8
|
||||
//thread( AZStd::bind(&MfTest::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::f8, AZStd::ref(x), 1, 2, 3, 4, 5, 6, 7, 8) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g8, x, 1, 2, 3, 4, 5, 6, 7, 8) , desc1).join();
|
||||
//thread( AZStd::bind(&MfTest::g8, AZStd::ref(x), 1, 2, 3, 4, 5, 6, 7, 8) , desc1).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::f8, AZStd::ref(x), 1, 2, 3, 4, 5, 6, 7, 8)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g8, x, 1, 2, 3, 4, 5, 6, 7, 8)).join();
|
||||
//thread( AZStd::bind(desc1, &MfTest::g8, AZStd::ref(x), 1, 2, 3, 4, 5, 6, 7, 8)).join();
|
||||
|
||||
AZ_TEST_ASSERT(x.m_hash == 1366);
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace UnitTest
|
||||
AZStd::thread m_threads[m_maxNumThreads];
|
||||
for (unsigned int i = 0; i < m_maxNumThreads; ++i)
|
||||
{
|
||||
m_threads[i] = AZStd::thread(AZStd::bind(&SystemAllocatorTest::ThreadFunc, this), &m_desc[i]);
|
||||
m_threads[i] = AZStd::thread(m_desc[i], AZStd::bind(&SystemAllocatorTest::ThreadFunc, this));
|
||||
// give some time offset to the threads so we can test alloc and dealloc at the same time.
|
||||
//AZStd::this_thread::sleep_for(AZStd::chrono::microseconds(500));
|
||||
}
|
||||
@@ -286,7 +286,7 @@ namespace UnitTest
|
||||
AZStd::thread m_threads[m_maxNumThreads];
|
||||
for (unsigned int i = 0; i < m_maxNumThreads; ++i)
|
||||
{
|
||||
m_threads[i] = AZStd::thread(AZStd::bind(&SystemAllocatorTest::ThreadFunc, this), &m_desc[i]);
|
||||
m_threads[i] = AZStd::thread(m_desc[i], AZStd::bind(&SystemAllocatorTest::ThreadFunc, this));
|
||||
// give some time offset to the threads so we can test alloc and dealloc at the same time.
|
||||
AZStd::this_thread::sleep_for(AZStd::chrono::microseconds(500));
|
||||
}
|
||||
@@ -724,7 +724,7 @@ namespace UnitTest
|
||||
AZStd::thread m_threads[m_maxNumThreads];
|
||||
for (unsigned int i = 0; i < m_maxNumThreads; ++i)
|
||||
{
|
||||
m_threads[i] = AZStd::thread(AZStd::bind(&ThreadPoolAllocatorTest::AllocDeallocFunc, this), &m_desc[i]);
|
||||
m_threads[i] = AZStd::thread(m_desc[i], AZStd::bind(&ThreadPoolAllocatorTest::AllocDeallocFunc, this));
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_maxNumThreads; ++i)
|
||||
@@ -743,12 +743,12 @@ namespace UnitTest
|
||||
|
||||
for (unsigned int i = m_maxNumThreads/2; i <m_maxNumThreads; ++i)
|
||||
{
|
||||
m_threads[i] = AZStd::thread(AZStd::bind(&ThreadPoolAllocatorTest::SharedDeAlloc, this), &m_desc[i]);
|
||||
m_threads[i] = AZStd::thread(m_desc[i], AZStd::bind(&ThreadPoolAllocatorTest::SharedDeAlloc, this));
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_maxNumThreads/2; ++i)
|
||||
{
|
||||
m_threads[i] = AZStd::thread(AZStd::bind(&ThreadPoolAllocatorTest::SharedAlloc, this), &m_desc[i]);
|
||||
m_threads[i] = AZStd::thread(m_desc[i], AZStd::bind(&ThreadPoolAllocatorTest::SharedAlloc, this));
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_maxNumThreads/2; ++i)
|
||||
|
||||
Reference in New Issue
Block a user