aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/code_ix.h
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-01-17 12:16:39 +0100
committerSverker Eriksson <[email protected]>2012-02-21 12:22:58 +0100
commit90209e4d57dd9b5ff27729b582f02c3d9e383f72 (patch)
treea91c441699120f0c4fd076cd470754f30a3a9fa1 /erts/emulator/beam/code_ix.h
parent41cf0cb977472a15527b6ac693883daaa84faa5a (diff)
downloadotp-90209e4d57dd9b5ff27729b582f02c3d9e383f72.tar.gz
otp-90209e4d57dd9b5ff27729b582f02c3d9e383f72.tar.bz2
otp-90209e4d57dd9b5ff27729b582f02c3d9e383f72.zip
erts: Multiple export tab's using code_ix
Still blocking code loading
Diffstat (limited to 'erts/emulator/beam/code_ix.h')
-rw-r--r--erts/emulator/beam/code_ix.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/erts/emulator/beam/code_ix.h b/erts/emulator/beam/code_ix.h
new file mode 100644
index 0000000000..6b81102269
--- /dev/null
+++ b/erts/emulator/beam/code_ix.h
@@ -0,0 +1,65 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2012-2012. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Erlang Public License,
+ * Version 1.1, (the "License"); you may not use this file except in
+ * compliance with the License. You should have received a copy of the
+ * Erlang Public License along with this software. If not, it can be
+ * retrieved online at http://www.erlang.org/.
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * %CopyrightEnd%
+ */
+#ifndef __CODE_IX_H__
+#define __CODE_IX_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
+
+#endif /* !__CODE_IX_H__ */