summaryrefslogtreecommitdiffstats
path: root/fastos/src/tests/threadtest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fastos/src/tests/threadtest.cpp')
-rw-r--r--fastos/src/tests/threadtest.cpp59
1 files changed, 1 insertions, 58 deletions
diff --git a/fastos/src/tests/threadtest.cpp b/fastos/src/tests/threadtest.cpp
index 1fa9820c8d7..129e067f229 100644
--- a/fastos/src/tests/threadtest.cpp
+++ b/fastos/src/tests/threadtest.cpp
@@ -6,7 +6,6 @@
#include <cstdlib>
#include <chrono>
-#define MUTEX_TEST_THREADS 6
#define MAX_THREADS 7
using namespace std::chrono;
@@ -62,7 +61,7 @@ class ThreadTest : public ThreadTestBase
for(i=0; i<MAX_THREADS; i++)
{
- jobs[i].code = PRINT_MESSAGE_AND_WAIT3SEC;
+ jobs[i].code = PRINT_MESSAGE_AND_WAIT3MSEC;
jobs[i].message = static_cast<char *>(malloc(100));
sprintf(jobs[i].message, "Thread %d invocation", i+1);
}
@@ -103,62 +102,6 @@ class ThreadTest : public ThreadTestBase
PrintSeparator();
}
-
- void HowManyThreadsTest ()
- {
- #define HOW_MAX_THREADS (1024)
- TestHeader("How Many Threads Test");
-
- FastOS_ThreadPool *pool = new FastOS_ThreadPool(128*1024, HOW_MAX_THREADS);
-
- if(Progress(pool != nullptr, "Allocating ThreadPool"))
- {
- int i;
- Job jobs[HOW_MAX_THREADS];
-
- for(i=0; i<HOW_MAX_THREADS; i++)
- {
- jobs[i].code = PRINT_MESSAGE_AND_WAIT3SEC;
- jobs[i].message = static_cast<char *>(malloc(100));
- sprintf(jobs[i].message, "Thread %d invocation", i+1);
- }
-
- for(i=0; i<HOW_MAX_THREADS; i++)
- {
- if(i==HOW_MAX_THREADS)
- {
- bool rc = (nullptr == pool->NewThread(this,
- static_cast<void *>(&jobs[0])));
- Progress(rc, "Creating too many threads should fail.");
- }
- else
- {
- bool rc = (nullptr != pool->NewThread(this,
- static_cast<void *>(&jobs[i])));
- Progress(rc, "Creating Thread");
- }
- };
-
- WaitForThreadsToFinish(jobs, HOW_MAX_THREADS);
-
- Progress(true, "Verifying result codes...");
- for(i=0; i<HOW_MAX_THREADS; i++)
- {
- Progress(jobs[i].result ==
- static_cast<int>(strlen(jobs[i].message)),
- "Checking result code from thread (%d==%d)",
- jobs[i].result, strlen(jobs[i].message));
- }
-
- Progress(true, "Closing threadpool...");
- pool->Close();
-
- Progress(true, "Deleting threadpool...");
- delete(pool);
- }
- PrintSeparator();
- }
-
void CreateSingleThreadAndJoin ()
{
TestHeader("Create Single Thread And Join Test");