|
1 /* |
|
2 * Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 using System; |
|
19 using System.Collections.Generic; |
|
20 using System.Text; |
|
21 using CrashDebuggerLib.Structures.KernelObjects; |
|
22 |
|
23 namespace CrashDebuggerLib.Structures.NThread |
|
24 { |
|
25 public class NThreadCountInfo |
|
26 { |
|
27 #region Enumerations |
|
28 public enum TCsFunctionType |
|
29 { |
|
30 EDoNothing = 0, |
|
31 ESuspendNTimes, |
|
32 EExitPending = -1, |
|
33 EExitInProgress = -2 |
|
34 } |
|
35 #endregion |
|
36 |
|
37 #region Constructors |
|
38 public NThreadCountInfo() |
|
39 { |
|
40 } |
|
41 #endregion |
|
42 |
|
43 #region API |
|
44 #endregion |
|
45 |
|
46 #region Properties |
|
47 public int RequestSemaphoreCount |
|
48 { |
|
49 get { return iRequestSemaphoreCount; } |
|
50 set { iRequestSemaphoreCount = value; } |
|
51 } |
|
52 |
|
53 public int SuspendCount |
|
54 { |
|
55 get { return iSuspendCount; } |
|
56 set { iSuspendCount = value; } |
|
57 } |
|
58 |
|
59 public int CsCount |
|
60 { |
|
61 get { return iCsCount; } |
|
62 set { iCsCount = value; } |
|
63 } |
|
64 |
|
65 public int CsFunction |
|
66 { |
|
67 get { return iCsFunction; } |
|
68 set { iCsFunction = value; } |
|
69 } |
|
70 |
|
71 public uint CsFunctionRaw |
|
72 { |
|
73 get { return (uint) iCsFunction; } |
|
74 set { iCsFunction = (int) value; } |
|
75 } |
|
76 |
|
77 public int CsFunctionSuspendCount |
|
78 { |
|
79 get |
|
80 { |
|
81 int ret = 0; |
|
82 // |
|
83 if ( CsFunctionType != TCsFunctionType.ESuspendNTimes ) |
|
84 { |
|
85 throw new ArgumentException( "CsFunction is not \'Suspend N Times\'" ); |
|
86 } |
|
87 // |
|
88 ret = iCsFunction; |
|
89 return ret; |
|
90 } |
|
91 } |
|
92 |
|
93 public TCsFunctionType CsFunctionType |
|
94 { |
|
95 get |
|
96 { |
|
97 TCsFunctionType ret = TCsFunctionType.EDoNothing; |
|
98 // |
|
99 if ( CsFunction > 0 ) |
|
100 { |
|
101 ret = TCsFunctionType.ESuspendNTimes; |
|
102 } |
|
103 else if ( CsFunction == -1 ) |
|
104 { |
|
105 ret = TCsFunctionType.EExitPending; |
|
106 } |
|
107 else if ( CsFunction == -2 ) |
|
108 { |
|
109 ret = TCsFunctionType.EExitInProgress; |
|
110 } |
|
111 // |
|
112 return ret; |
|
113 } |
|
114 } |
|
115 #endregion |
|
116 |
|
117 #region Internal methods |
|
118 #endregion |
|
119 |
|
120 #region Internal constants |
|
121 #endregion |
|
122 |
|
123 #region From System.Object |
|
124 public override string ToString() |
|
125 { |
|
126 return base.ToString(); |
|
127 } |
|
128 #endregion |
|
129 |
|
130 #region Data members |
|
131 private int iRequestSemaphoreCount = 0; |
|
132 private int iSuspendCount = 0; // -how many times we have been suspended |
|
133 private int iCsCount = 0; // critical section count |
|
134 private int iCsFunction = 0; // what to do on leaving CS: +n=suspend n times, 0=nothing, -1=exit |
|
135 #endregion |
|
136 } |
|
137 } |