File: ThreadStaticAttribute.xml

package info (click to toggle)
monodoc 1.1.18-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 58,432 kB
  • ctags: 4,991
  • sloc: xml: 718,392; cs: 38,337; sh: 3,172; perl: 554; makefile: 303
file content (68 lines) | stat: -rwxr-xr-x 2,272 bytes parent folder | download
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
<Type Name="ThreadStaticAttribute" FullName="System.ThreadStaticAttribute">
  <TypeSignature Maintainer="auto" Language="C#" Value="public class ThreadStaticAttribute : System.Attribute" />
  <AssemblyInfo>
    <AssemblyName>mscorlib</AssemblyName>
    <AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00]</AssemblyPublicKey>
    <AssemblyVersion>1.0.5000.0</AssemblyVersion>
  </AssemblyInfo>
  <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the &lt;link location="node:gtk-sharp/programming/threads"&gt;Gtk# Thread Programming&lt;/link&gt; for details.</ThreadSafetyStatement>
  <Docs>
    <summary>Flags a static field as thread-static.</summary>
    <remarks>This attribute is used to flag static fields as being thread-specific.  Different threads will see different values for the same static field. 

<para>
Consider the following program:
</para><example>
        <code lang="C#">
using System;
using System.Threading;

class T {
        [ThreadStatic]
        static int var = 5;

        static void thread () {
                Console.WriteLine ("value from second thread: {0}", var);
        }

        static void Main () {
                var  = 10;
                Thread thr = new Thread (new ThreadStart (thread));
                thr.Start ();
                Console.WriteLine ("value in main thread: {0}", var);
                thr.Join ();
                Console.WriteLine ("value in main thread after join: {0}", var);
        }
}
  </code>
      </example><para>
   The display will be:
</para><para>
value in main thread: 10
value from second thread: 0
value in main thread after join: 10

</para></remarks>
  </Docs>
  <Base>
    <BaseTypeName>System.Attribute</BaseTypeName>
  </Base>
  <Interfaces />
  <Attributes>
    <Attribute>
      <AttributeName>System.AttributeUsage(System.AttributeTargets.Field, Inherited=false)</AttributeName>
    </Attribute>
  </Attributes>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public ThreadStaticAttribute ();" />
      <MemberType>Constructor</MemberType>
      <ReturnValue />
      <Parameters />
      <Docs>
        <summary>Constructor.</summary>
        <remarks />
      </Docs>
    </Member>
  </Members>
</Type>