38 |
} |
} |
39 |
|
|
40 |
/* Acquire the metadata write lock and disable finalizers */ |
/* Acquire the metadata write lock and disable finalizers */ |
41 |
IL_METADATA_WRLOCK(thread); |
IL_METADATA_WRLOCK(_ILExecThreadProcess(thread)); |
42 |
ILGCDisableFinalizers(0); |
ILGCDisableFinalizers(0); |
43 |
|
|
44 |
/* Lay out the class's fields. This will check for layout |
/* Lay out the class's fields. This will check for layout |
45 |
again, to avoid race condition situations */ |
again, to avoid race condition situations */ |
46 |
if(!_ILLayoutClass(classInfo)) |
if(!_ILLayoutClass(_ILExecThreadProcess(thread), classInfo)) |
47 |
{ |
{ |
48 |
/* Throw a "TypeInitializationException" */ |
/* Throw a "TypeInitializationException" */ |
49 |
ILGCEnableFinalizers(); |
ILGCEnableFinalizers(); |
50 |
IL_METADATA_UNLOCK(thread); |
IL_METADATA_UNLOCK(_ILExecThreadProcess(thread)); |
51 |
ILGCInvokeFinalizers(0); |
ILGCInvokeFinalizers(0); |
52 |
thread->thrownException = _ILSystemException |
thread->thrownException = _ILSystemException |
53 |
(thread, "System.TypeInitializationException"); |
(thread, "System.TypeInitializationException"); |
56 |
|
|
57 |
/* Re-enable finalizers and unlock the metadata write lock */ |
/* Re-enable finalizers and unlock the metadata write lock */ |
58 |
ILGCEnableFinalizers(); |
ILGCEnableFinalizers(); |
59 |
IL_METADATA_UNLOCK(thread); |
IL_METADATA_UNLOCK(_ILExecThreadProcess(thread)); |
60 |
ILGCInvokeFinalizers(0); |
ILGCInvokeFinalizers(0); |
61 |
return 1; |
return 1; |
62 |
} |
} |