aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/code_ix.h
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-02-10 18:22:42 +0100
committerSverker Eriksson <[email protected]>2012-02-21 12:23:09 +0100
commitc4a8cc5914157c70ced742d957ec0e8d9c618164 (patch)
tree0ff4584ccb1d512b3fd48f596414f505d708c35f /erts/emulator/beam/code_ix.h
parent7da22e299ad0d2d6bf389650f4d74f4f22242111 (diff)
downloadotp-c4a8cc5914157c70ced742d957ec0e8d9c618164.tar.gz
otp-c4a8cc5914157c70ced742d957ec0e8d9c618164.tar.bz2
otp-c4a8cc5914157c70ced742d957ec0e8d9c618164.zip
erts: Suspend processes waiting for code_ix lock
This will prevent blocking entrire schedulers in the rare case when several processes are racing to load/upgrade/delete/purge code.
Diffstat (limited to 'erts/emulator/beam/code_ix.h')
-rw-r--r--erts/emulator/beam/code_ix.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/erts/emulator/beam/code_ix.h b/erts/emulator/beam/code_ix.h
index 99fd4ec348..66543fa2a8 100644
--- a/erts/emulator/beam/code_ix.h
+++ b/erts/emulator/beam/code_ix.h
@@ -55,10 +55,13 @@
# endif
# include "sys.h"
#endif
+struct process;
+
#define ERTS_NUM_CODE_IX 3
typedef unsigned ErtsCodeIndex;
+
/* Called once at emulator initialization.
*/
void erts_code_ix_init(void);
@@ -78,14 +81,13 @@ ErtsCodeIndex erts_active_code_ix(void);
ERTS_GLB_INLINE
ErtsCodeIndex erts_staging_code_ix(void);
-/* Lock code_ix.
- * Gives (exclusive) access to the staging area and write access to active code index.
- * ToDo: Waiting process should be queued and return to be suspended.
+/* Try lock code_ix that is needed for (exlusive) access of the staging area.
+ * Main process lock (only) must be held.
+ * Caller is suspended and *must* yield if 0 is returned.
*/
-void erts_lock_code_ix(void);
+int erts_try_lock_code_ix(struct process*);
/* Unlock code_ix
- * ToDo: Dequeue and resume waiting processes.
*/
void erts_unlock_code_ix(void);