aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2011-12-09 19:55:50 +0100
committerPatrik Nyblom <[email protected]>2011-12-09 19:55:57 +0100
commitf20b520b0d2d990ab70b56345b63a8b508edde1a (patch)
treeb9df775ae522e006ca670215e96b86d722413f9b /erts
parent40bc5cf36abb9697f07f788fa679a7d18903ba14 (diff)
parente3b1ff5a7168b221f227853e82433b84504db1fc (diff)
downloadotp-f20b520b0d2d990ab70b56345b63a8b508edde1a.tar.gz
otp-f20b520b0d2d990ab70b56345b63a8b508edde1a.tar.bz2
otp-f20b520b0d2d990ab70b56345b63a8b508edde1a.zip
Merge branch 'pan/win64-fixes'
* pan/win64-fixes: Update INSTALL-WIN32.md to reflect changes in R15B Make erl_alloc.c use correct strtol variant on windows Set absolute limit on number of threads in ethread_SUITE OTP-9130
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/erl_alloc.c6
-rw-r--r--erts/emulator/beam/sys.h8
-rw-r--r--erts/test/ethread_SUITE_data/ethread_tests.c12
3 files changed, 21 insertions, 5 deletions
diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c
index 1e75afe6f6..4d02a67d54 100644
--- a/erts/emulator/beam/erl_alloc.c
+++ b/erts/emulator/beam/erl_alloc.c
@@ -1095,7 +1095,7 @@ get_kb_value(char *param_end, char** argv, int* ip)
char *param = argv[*ip]+1;
char *value = get_value(param_end, argv, ip);
errno = 0;
- tmp = (Sint) strtol(value, &rest, 10);
+ tmp = (Sint) ErtsStrToSint(value, &rest, 10);
if (errno != 0 || rest == value || tmp < 0 || max < ((Uint) tmp))
bad_value(param, param_end, value);
if (max == (Uint) tmp)
@@ -1112,7 +1112,7 @@ get_byte_value(char *param_end, char** argv, int* ip)
char *param = argv[*ip]+1;
char *value = get_value(param_end, argv, ip);
errno = 0;
- tmp = (Sint) strtol(value, &rest, 10);
+ tmp = (Sint) ErtsStrToSint(value, &rest, 10);
if (errno != 0 || rest == value || tmp < 0)
bad_value(param, param_end, value);
return (Uint) tmp;
@@ -1126,7 +1126,7 @@ get_amount_value(char *param_end, char** argv, int* ip)
char *param = argv[*ip]+1;
char *value = get_value(param_end, argv, ip);
errno = 0;
- tmp = (Sint) strtol(value, &rest, 10);
+ tmp = (Sint) ErtsStrToSint(value, &rest, 10);
if (errno != 0 || rest == value || tmp < 0)
bad_value(param, param_end, value);
return (Uint) tmp;
diff --git a/erts/emulator/beam/sys.h b/erts/emulator/beam/sys.h
index 6b4b382caa..eb6f2f8516 100644
--- a/erts/emulator/beam/sys.h
+++ b/erts/emulator/beam/sys.h
@@ -256,6 +256,7 @@ typedef unsigned int Eterm;
typedef unsigned int Uint;
typedef int Sint;
#define ERTS_SIZEOF_ETERM SIZEOF_INT
+#define ErtsStrToSint strtol
#else
#error Found no appropriate type to use for 'Eterm', 'Uint' and 'Sint'
#endif
@@ -288,6 +289,7 @@ typedef long Sint;
#define SWORD_CONSTANT(Const) Const##L
#define UWORD_CONSTANT(Const) Const##UL
#define ERTS_SIZEOF_ETERM SIZEOF_LONG
+#define ErtsStrToSint strtol
#elif SIZEOF_VOID_P == SIZEOF_INT
typedef unsigned int Eterm;
typedef unsigned int Uint;
@@ -295,6 +297,7 @@ typedef int Sint;
#define SWORD_CONSTANT(Const) Const
#define UWORD_CONSTANT(Const) Const##U
#define ERTS_SIZEOF_ETERM SIZEOF_INT
+#define ErtsStrToSint strtol
#elif SIZEOF_VOID_P == SIZEOF_LONG_LONG
typedef unsigned long long Eterm;
typedef unsigned long long Uint;
@@ -302,6 +305,11 @@ typedef long long Sint;
#define SWORD_CONSTANT(Const) Const##LL
#define UWORD_CONSTANT(Const) Const##ULL
#define ERTS_SIZEOF_ETERM SIZEOF_LONG_LONG
+#if defined(__WIN32__)
+#define ErtsStrToSint _strtoi64
+#else
+#define ErtsStrToSint strtoll
+#endif
#else
#error Found no appropriate type to use for 'Eterm', 'Uint' and 'Sint'
#endif
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;