标签:
The code of a module can exists in two variants in a system: current code and old code. When a module is loaded into the system for the first time, the code of the module becomes ‘current‘ and the global export table is updated with references to all functions exported from the module.
If then a new instance of the module is loaded (perhaps because of the correction of an error), then the code of the previous instance becomes ‘old‘, and all export entries referring to the previous instance are removed. After that the new instance is loaded as if it was loaded for the first time, as described above, and becomes ‘current‘.
Both old and current code for a module are valid, and may even be evaluated concurrently. The difference is that exported functions in old code are unavailable. Hence there is no way to make a global call to an exported function in old code, but old code may still be evaluated because of processes lingering in it.
If a third instance of the module is loaded, the code server will remove (purge) the old code and any processes lingering in it will be terminated. Then the third instance becomes ‘current‘ and the previously current code becomes ‘old‘.
For more information about old and current code, and how to make a process switch from old to current code, refer to Erlang Reference Manual.
标签:
原文地址:http://www.cnblogs.com/huangriq/p/4584500.html