diff options
author | Sverker Eriksson <[email protected]> | 2012-02-15 15:12:18 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2012-02-21 15:32:07 +0100 |
commit | dc2b0ecba50cbe6b2f2321b1f24579a0353ced18 (patch) | |
tree | 0ad297a07792533c1d2820c5ca69a886f3239e03 /erts/emulator/beam/code_ix.h | |
parent | c4a8cc5914157c70ced742d957ec0e8d9c618164 (diff) | |
download | otp-dc2b0ecba50cbe6b2f2321b1f24579a0353ced18.tar.gz otp-dc2b0ecba50cbe6b2f2321b1f24579a0353ced18.tar.bz2 otp-dc2b0ecba50cbe6b2f2321b1f24579a0353ced18.zip |
erts: Activate staged code in a thread safe way
Activation of staged code is scheduled for a later moment when
all schedulers have done a full memory barrier. This allow
them to read active code index while executing without any
memory barriers at all.
Diffstat (limited to 'erts/emulator/beam/code_ix.h')
-rw-r--r-- | erts/emulator/beam/code_ix.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/erts/emulator/beam/code_ix.h b/erts/emulator/beam/code_ix.h index 66543fa2a8..bac8c3365c 100644 --- a/erts/emulator/beam/code_ix.h +++ b/erts/emulator/beam/code_ix.h @@ -91,22 +91,27 @@ int erts_try_lock_code_ix(struct process*); */ void erts_unlock_code_ix(void); -/* Make the "staging area" a complete copy of the active code. +/* Prepare the "staging area" to be a complete copy of the active code. * code_ix must be locked. - * Must be followed by a call to either "commit" or "abort" before code_ix lock - * is released. + * Must be followed by calls to either "end" and "activate" or "abort" before + * code_ix lock is released. */ void erts_start_staging_code_ix(void); -/* Commit the staging area and update the active code index. - * code_ix must be locked and erts_start_staging_code_ix() called. - * ToDo: Updating active code index should be done according to Rickard's recipe. - * This function might need to be split into two. +/* End the staging. + * code_ix must be locked. + * Must be followed by a call to either "activate" or "abort" + * before code_ix lock is released. + */ +void erts_end_staging_code_ix(void); + +/* Set staging code index as new active code index. + * code_ix must be locked and "start" and "end" called. */ -void erts_commit_staging_code_ix(void); +void erts_activate_staging_code_ix(void); /* Abort the staging. - * code_ix must be locked and erts_start_staging_code_ix() called. + * code_ix must be locked and "start" called. */ void erts_abort_staging_code_ix(void); |