aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_thr_progress.c
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2014-12-19 10:53:27 +0100
committerLukas Larsson <[email protected]>2014-12-19 10:53:27 +0100
commit3e3ef7b16fa03a7b9f4e5376387750a69957719f (patch)
tree40d74a3d6ccd8a4faa5c7194979584fa67517ea1 /erts/emulator/beam/erl_thr_progress.c
parenta4d72d2cae3a9bd3f0dccdb663f70d54a45fe10f (diff)
parentbd4b900c09308a6c3ab41e3a2070cb90410ee01d (diff)
downloadotp-3e3ef7b16fa03a7b9f4e5376387750a69957719f.tar.gz
otp-3e3ef7b16fa03a7b9f4e5376387750a69957719f.tar.bz2
otp-3e3ef7b16fa03a7b9f4e5376387750a69957719f.zip
Merge branch 'lukas/erts/crashdump_improvements/OTP-12377'
* lukas/erts/crashdump_improvements/OTP-12377: erts: Make main thread safe from pipe closed event erts: Improve crash dumps erts: Rename sys_sigset to sys_signal erts: Introduce thread suspend functions erts: Remove usage of QUANTIFY signal erts: Add support for thread names ets: Increase data available in crash dumps and ets:info erts: Start compilation of beam_emu earlier
Diffstat (limited to 'erts/emulator/beam/erl_thr_progress.c')
-rw-r--r--erts/emulator/beam/erl_thr_progress.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/erts/emulator/beam/erl_thr_progress.c b/erts/emulator/beam/erl_thr_progress.c
index 664c479eb6..c2365c5cf7 100644
--- a/erts/emulator/beam/erl_thr_progress.c
+++ b/erts/emulator/beam/erl_thr_progress.c
@@ -1335,25 +1335,10 @@ erts_thr_progress_block(void)
thr_progress_block(tmp_thr_prgr_data(NULL), 1);
}
-void
-erts_thr_progress_fatal_error_block(SWord timeout,
- ErtsThrPrgrData *tmp_tpd_bufp)
+int
+erts_thr_progress_fatal_error_block(ErtsThrPrgrData *tmp_tpd_bufp)
{
ErtsThrPrgrData *tpd = perhaps_thr_prgr_data(NULL);
- erts_aint32_t bc;
- SWord time_left = timeout;
- SysTimeval to;
-
- /*
- * Counting poll intervals may give us a too long timeout
- * if cpu is busy. If we got tolerant time of day we use it
- * to prevent this.
- */
- if (!erts_disable_tolerant_timeofday) {
- erts_get_timeval(&to);
- to.tv_sec += timeout / 1000;
- to.tv_sec += timeout % 1000;
- }
if (!tpd) {
/*
@@ -1366,9 +1351,26 @@ erts_thr_progress_fatal_error_block(SWord timeout,
init_tmp_thr_prgr_data(tpd);
}
- bc = thr_progress_block(tpd, 0);
- if (bc == 0)
- return; /* Succefully blocked all managed threads */
+ /* Returns number of threads that have not yes been blocked */
+ return thr_progress_block(tpd, 0);
+}
+
+void
+erts_thr_progress_fatal_error_wait(SWord timeout) {
+ erts_aint32_t bc;
+ SWord time_left = timeout;
+ SysTimeval to;
+
+ /*
+ * Counting poll intervals may give us a too long timeout
+ * if cpu is busy. If we got tolerant time of day we use it
+ * to prevent this.
+ */
+ if (!erts_disable_tolerant_timeofday) {
+ erts_get_timeval(&to);
+ to.tv_sec += timeout / 1000;
+ to.tv_sec += timeout % 1000;
+ }
while (1) {
if (erts_milli_sleep(ERTS_THR_PRGR_FTL_ERR_BLCK_POLL_INTERVAL) == 0)