PageRenderTime 22ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/vm/mvm-windows.cpp

http://github.com/abeaumont/factor
C++ | 25 lines | 19 code | 6 blank | 0 comment | 3 complexity | 1dcc1251c97c4c9994459e621c65baf2 MD5 | raw file
 1#include "master.hpp"
 2
 3namespace factor
 4{
 5
 6DWORD current_vm_tls_key; 
 7
 8void init_mvm()
 9{
10	if((current_vm_tls_key = TlsAlloc()) == TLS_OUT_OF_INDEXES)
11		fatal_error("TlsAlloc() failed",0);
12}
13
14void register_vm_with_thread(factor_vm *vm)
15{
16	if(!TlsSetValue(current_vm_tls_key, vm))
17		fatal_error("TlsSetValue() failed",0);
18}
19
20factor_vm *current_vm_p()
21{
22	return (factor_vm *)TlsGetValue(current_vm_tls_key);
23}
24
25}