aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/global.h
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-01-17 11:18:26 +0100
committerSverker Eriksson <[email protected]>2012-02-21 12:22:57 +0100
commit41cf0cb977472a15527b6ac693883daaa84faa5a (patch)
treea5338019a019fdec255796f0dd48a1b2b3c2f44f /erts/emulator/beam/global.h
parent587e7c4a43e5650637390719dc9df2586368d60b (diff)
downloadotp-41cf0cb977472a15527b6ac693883daaa84faa5a.tar.gz
otp-41cf0cb977472a15527b6ac693883daaa84faa5a.tar.bz2
otp-41cf0cb977472a15527b6ac693883daaa84faa5a.zip
erts: First stab at code_ix interface and beam_catches using it
Code loading still blocking
Diffstat (limited to 'erts/emulator/beam/global.h')
-rw-r--r--erts/emulator/beam/global.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index 46bc58891b..8745ca610b 100644
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -28,6 +28,50 @@
#include "hash.h"
#include "index.h"
#include "atom.h"
+
+/*SVERK maybe put this is some other header, must be before module.h and export.h */
+#define ERTS_NUM_CODE_IX 3
+typedef unsigned ErtsCodeIndex;
+
+void erts_code_ix_init(void);
+ErtsCodeIndex erts_active_code_ix(void);
+ErtsCodeIndex erts_loader_code_ix(void);
+
+/* Lock code_ix (enqueue and suspend until we get it)
+*/
+void erts_lock_code_ix(void);
+
+/*SVERK
+ erts_lock_code_ix();
+ wait for thread progress
+ (we don't want any retarded threads with pointers to inactive Module)
+ Copy active -> loader
+ rlock old_code while copying Modules
+ Update loader
+ wait for thread progress
+ (we need a membarrier for everybody to "see" the new code)
+ Set loader as new active
+ erts_unlock_code_ix();
+}*/
+
+
+/* Unlock code_ix (resume first waiter)
+*/
+void erts_unlock_code_ix(void);
+void erts_start_loader_code_ix(void);
+void erts_commit_loader_code_ix(void);
+void erts_abort_loader_code_ix(void);
+
+void erts_rwlock_old_code(void);
+void erts_rwunlock_old_code(void);
+void erts_rlock_old_code(void);
+void erts_runlock_old_code(void);
+
+#ifdef ERTS_ENABLE_LOCK_CHECK
+int erts_is_old_code_rlocked(void);
+int erts_is_code_ix_locked(void);
+#endif
+
#include "export.h"
#include "module.h"
#include "register.h"