1 // natVMAccessControlState.cc -- Native part of the VMAccessControlState class.
2 
3 /* Copyright (C) 2006 Free Software Foundation, Inc.
4 
5    This file is part of libgcj.
6 
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9 details.  */
10 
11 #include <config.h>
12 
13 #include <gcj/cni.h>
14 #include <jvm.h>
15 
16 #include <java/lang/Thread.h>
17 #include <java/security/VMAccessControlState.h>
18 
19 java::security::VMAccessControlState *
getThreadState()20 java::security::VMAccessControlState::getThreadState ()
21 {
22   java::lang::Thread *thread = java::lang::Thread::currentThread ();
23   if (thread == NULL)
24     return NULL;
25 
26   VMAccessControlState *state =
27     reinterpret_cast<VMAccessControlState *> (thread->accessControlState);
28   if (state == NULL)
29     thread->accessControlState = state = new VMAccessControlState ();
30 
31   return state;
32 }
33