aboutsummaryrefslogtreecommitdiffstats
path: root/erts/test/ethread_SUITE_data/ethread_tests.c
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2011-12-05 14:14:12 +0100
committerPatrik Nyblom <[email protected]>2011-12-08 16:35:08 +0100
commit6cd08b5fc2e2b34dba816735ae1864bf68362791 (patch)
treef74a1a3897f088620a37f23111b18220304b4019 /erts/test/ethread_SUITE_data/ethread_tests.c
parent7d79fd6eb57a073e58080d52e98881bd85f8fcc9 (diff)
downloadotp-6cd08b5fc2e2b34dba816735ae1864bf68362791.tar.gz
otp-6cd08b5fc2e2b34dba816735ae1864bf68362791.tar.bz2
otp-6cd08b5fc2e2b34dba816735ae1864bf68362791.zip
Set absolute limit on number of threads in ethread_SUITE
Win64 has no limit on number of threads, at least not one you will reach before the memory gets exhausted on a mainstream machine. Therefore the testcase max_threads has to stop at some point before we consume all virtual memory in the machine. An arbitrary limit of 80000 threads was added.
Diffstat (limited to 'erts/test/ethread_SUITE_data/ethread_tests.c')
-rw-r--r--erts/test/ethread_SUITE_data/ethread_tests.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/erts/test/ethread_SUITE_data/ethread_tests.c b/erts/test/ethread_SUITE_data/ethread_tests.c
index 7e7e133d6c..ed96ecdbd2 100644
--- a/erts/test/ethread_SUITE_data/ethread_tests.c
+++ b/erts/test/ethread_SUITE_data/ethread_tests.c
@@ -82,6 +82,7 @@ static void
print_eol(void)
{
fprintf(stderr, EOL);
+ fflush(stderr);
}
static void print_line(char *frmt,...)
@@ -826,6 +827,7 @@ detached_thread_test(void)
* Tests
*/
#define MTT_TIMES 10
+#define MTT_HARD_LIMIT (80000)
static int mtt_terminate;
static ethr_mutex mtt_mutex;
@@ -866,14 +868,20 @@ mtt_create_join_threads(void)
while (1) {
if (ix >= no_tids) {
no_tids += 100;
+ if (no_tids > MTT_HARD_LIMIT) {
+ print_line("Hit the hard limit on number of threads (%d)!",
+ MTT_HARD_LIMIT);
+ break;
+ }
tids = (ethr_tid *) realloc((void *)tids, sizeof(ethr_tid)*no_tids);
ASSERT(tids);
}
res = ethr_thr_create(&tids[ix], mtt_thread, NULL, NULL);
- if (res != 0)
+ if (res != 0) {
break;
+ }
ix++;
- } while (res == 0);
+ }
no_threads = ix;