summaryrefslogtreecommitdiff
path: root/src/vm/delegateinfo.h
blob: c8a3e36c2e44e72455c53f96080365b684d85aff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

/*============================================================
**
** Header: DelegateInfo.h
**
**
** Purpose: Native methods on System.ThreadPool
**          and its inner classes
**

** 
===========================================================*/
#ifndef DELEGATE_INFO
#define DELEGATE_INFO

struct DelegateInfo;
typedef DelegateInfo* DelegateInfoPtr;

struct DelegateInfo
{
    ADID            m_appDomainId;
    OBJECTHANDLE    m_stateHandle;
    OBJECTHANDLE    m_eventHandle;
    OBJECTHANDLE    m_registeredWaitHandle;
    DWORD           m_overridesCount;
    BOOL            m_hasSecurityInfo;

    void SetThreadSecurityInfo( Thread* thread, StackCrawlMark* stackMark )
    {
        CONTRACTL {
            THROWS;
            GC_TRIGGERS;
            MODE_COOPERATIVE; 
            INJECT_FAULT(COMPlusThrowOM());
        }
        CONTRACTL_END;


    }

#ifndef DACCESS_COMPILE
    void Release()
    {
        CONTRACTL {
            // m_compressedStack->Release() can actually throw today because it has got a call
            // to new down the stack. However that is recent and the semantic of that api is such
            // it should not throw. I am expecting clenup of that function to take care of that
            // so I am adding this comment to make sure the issue is document.
            // Remove this comment once that work is done
            NOTHROW;
            GC_TRIGGERS;
            MODE_COOPERATIVE; 
            FORBID_FAULT;
        }
        CONTRACTL_END;


        AppDomainFromIDHolder ad(m_appDomainId, FALSE);
        if (!ad.IsUnloaded())
        {
            if (m_stateHandle)
                DestroyHandle(m_stateHandle);
            if (m_eventHandle)
            	 DestroyHandle(m_eventHandle);
            if (m_registeredWaitHandle)
               DestroyHandle(m_registeredWaitHandle);
        }

    }
#endif

    static DelegateInfo  *MakeDelegateInfo(AppDomain *pAppDomain,
                                           OBJECTREF *state,
                                           OBJECTREF *waitEvent,
                                           OBJECTREF *registeredWaitObject);
};





#endif // DELEGATE_INFO