/vm/mvm-windows.cpp
http://github.com/abeaumont/factor · C++ · 25 lines · 19 code · 6 blank · 0 comment · 3 complexity · 1dcc1251c97c4c9994459e621c65baf2 MD5 · raw file
- #include "master.hpp"
- namespace factor
- {
- DWORD current_vm_tls_key;
- void init_mvm()
- {
- if((current_vm_tls_key = TlsAlloc()) == TLS_OUT_OF_INDEXES)
- fatal_error("TlsAlloc() failed",0);
- }
- void register_vm_with_thread(factor_vm *vm)
- {
- if(!TlsSetValue(current_vm_tls_key, vm))
- fatal_error("TlsSetValue() failed",0);
- }
- factor_vm *current_vm_p()
- {
- return (factor_vm *)TlsGetValue(current_vm_tls_key);
- }
- }