aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_thr_progress.h
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2011-10-10 21:03:10 +0200
committerRickard Green <[email protected]>2011-11-13 20:40:56 +0100
commitbc5818cfdd56e19a16357f4443d80a56426aa134 (patch)
treebfe53d3e0cf24ccd7374e0174c1a4c441ab2e097 /erts/emulator/beam/erl_thr_progress.h
parenta67e91e658bdbba24fcc3c79b06fdf10ff830bc9 (diff)
downloadotp-bc5818cfdd56e19a16357f4443d80a56426aa134.tar.gz
otp-bc5818cfdd56e19a16357f4443d80a56426aa134.tar.bz2
otp-bc5818cfdd56e19a16357f4443d80a56426aa134.zip
Replace system block with thread progress block
The ERTS internal system block functionality has been replaced by new functionality for blocking the system. The old system block functionality had contention issues and complexity issues. The new functionality piggy-backs on thread progress tracking functionality needed by newly introduced lock-free synchronization in the runtime system. When the functionality for blocking the system isn't used there is more or less no overhead at all. This since the functionality for tracking thread progress is there and needed anyway.
Diffstat (limited to 'erts/emulator/beam/erl_thr_progress.h')
-rw-r--r--erts/emulator/beam/erl_thr_progress.h35
1 files changed, 29 insertions, 6 deletions
diff --git a/erts/emulator/beam/erl_thr_progress.h b/erts/emulator/beam/erl_thr_progress.h
index 36880c10f0..68d14174b9 100644
--- a/erts/emulator/beam/erl_thr_progress.h
+++ b/erts/emulator/beam/erl_thr_progress.h
@@ -32,7 +32,22 @@
#include "sys.h"
-#ifdef ERTS_SMP
+#ifndef ERTS_SMP
+
+#define erts_smp_thr_progress_block() ((void) 0)
+#define erts_smp_thr_progress_unblock() ((void) 0)
+#define erts_smp_thr_progress_is_blocking() 1
+
+#else /* ERTS_SMP */
+
+#define erts_smp_thr_progress_block erts_thr_progress_block
+#define erts_smp_thr_progress_unblock erts_thr_progress_unblock
+#define erts_smp_thr_progress_is_blocking erts_thr_progress_is_blocking
+
+void erts_thr_progress_fatal_error_block(SWord timeout);
+void erts_thr_progress_block(void);
+void erts_thr_progress_unblock(void);
+int erts_thr_progress_is_blocking(void);
typedef Uint64 ErtsThrPrgrVal;
@@ -41,9 +56,14 @@ typedef Uint64 ErtsThrPrgrVal;
typedef struct {
int id;
int is_managed;
+ int is_blocking;
+ int is_temporary;
+
+ /* --- Part below only for registered threads --- */
+
ErtsThrPrgrVal wakeup_request[ERTS_THR_PRGR_WAKEUP_DATA_SIZE];
- /* --- Part below only for managed threads */
+ /* --- Part below only for managed threads --- */
int leader; /* Needs to be first in the managed threads part */
int active;
@@ -77,8 +97,11 @@ extern erts_tsd_key_t erts_thr_prgr_data_key__;
typedef struct {
void *arg;
- void (*wakeup)(void *arg);
-} ErtsThrPrgrWakeupCallback;
+ void (*wakeup)(void *);
+ void (*prepare_wait)(void *);
+ void (*wait)(void *);
+ void (*finalize_wait)(void *);
+} ErtsThrPrgrCallbacks;
typedef struct {
ERTS_THR_PRGR_ATOMIC current;
@@ -89,9 +112,9 @@ extern ErtsThrPrgr erts_thr_prgr__;
void erts_thr_progress_pre_init(void);
void erts_thr_progress_init(int no_schedulers, int managed, int unmanaged);
void erts_thr_progress_register_managed_thread(ErtsSchedulerData *esdp,
- ErtsThrPrgrWakeupCallback *,
+ ErtsThrPrgrCallbacks *,
int);
-void erts_thr_progress_register_unmanaged_thread(ErtsThrPrgrWakeupCallback *);
+void erts_thr_progress_register_unmanaged_thread(ErtsThrPrgrCallbacks *);
void erts_thr_progress_active(ErtsSchedulerData *esdp, int on);
void erts_thr_progress_wakeup(ErtsSchedulerData *esdp,
ErtsThrPrgrVal value);