.NET Framework Class Library
Thread Members

Creates and controls a thread, sets its priority, and gets its status.

The Thread type exposes the following members.

Constructors

  NameDescription
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkThreadOverloaded. Initializes a new instance of the Thread class.
Top
Methods

  NameDescription
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkAbortOverloaded. Raises a ThreadAbortException in the thread on which it is invoked, to begin the process of terminating the thread. Calling this method usually terminates the thread.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkAllocateDataSlotAllocates an unnamed data slot on all the threads. For better performance, use fields that are marked with the ThreadStaticAttribute attribute instead.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkAllocateNamedDataSlotAllocates a named data slot on all threads. For better performance, use fields that are marked with the ThreadStaticAttribute attribute instead.
Public methodStatic memberBeginCriticalRegionNotifies a host that execution is about to enter a region of code in which the effects of a thread abort or unhandled exception might jeopardize other tasks in the application domain.
Public methodStatic memberBeginThreadAffinityNotifies a host that managed code is about to execute instructions that depend on the identity of the current physical operating system thread.
Public methodStatic memberEndCriticalRegionNotifies a host that execution is about to enter a region of code in which the effects of a thread abort or unhandled exception are limited to the current task.
Public methodStatic memberEndThreadAffinityNotifies a host that managed code has finished executing instructions that depend on the identity of the current physical operating system thread.
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkEqualsDetermines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkFinalizeOverloaded.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkFreeNamedDataSlotEliminates the association between a name and a slot, for all threads in the process. For better performance, use fields that are marked with the ThreadStaticAttribute attribute instead.
Public methodGetApartmentStateReturns an ApartmentState value indicating the apartment state.
Public methodGetCompressedStack Obsolete. Returns a CompressedStack object that can be used to capture the stack for the current thread.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetDataRetrieves the value from the specified slot on the current thread, within the current thread's current domain. For better performance, use fields that are marked with the ThreadStaticAttribute attribute instead.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetDomainReturns the current domain in which the current thread is running.
Public methodStatic memberGetDomainIDReturns a unique application domain identifier.
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetHashCodeOverloaded.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetNamedDataSlotLooks up a named data slot. For better performance, use fields that are marked with the ThreadStaticAttribute attribute instead.
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInterruptInterrupts a thread that is in the WaitSleepJoin thread state.
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkJoinOverloaded. Blocks the calling thread until a thread terminates.
Protected methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkMemoryBarrierSynchronizes memory access as follows: The processor executing the current thread cannot reorder instructions in such a way that memory accesses prior to the call to MemoryBarrier execute after memory accesses that follow the call to MemoryBarrier.
Public methodStatic memberResetAbortCancels an Abort requested for the current thread.
Public methodResume Obsolete. Resumes a thread that has been suspended.
Public methodSetApartmentStateSets the apartment state of a thread before it is started.
Public methodSetCompressedStack Obsolete. Applies a captured CompressedStack to the current thread.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkSetDataSets the data in the specified slot on the currently running thread, for that thread's current domain. For better performance, use fields marked with the ThreadStaticAttribute attribute instead.
Public methodSupported by the XNA FrameworkSetProcessorAffinityIn the .NET Compact Framework for Xbox 360, sets the processor affinity for a managed thread. Processor affinity determines the processors on which a thread runs.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkSleepOverloaded. Blocks the current thread for the specified number of milliseconds.
Public methodStatic memberSpinWaitCauses a thread to wait the number of times defined by the iterations parameter.
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkStartOverloaded. Causes a thread to be scheduled for execution.
Public methodSuspend Obsolete. Either suspends the thread, or if the thread is already suspended, has no effect.
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkToStringReturns a String that represents the current Object. (Inherited from Object.)
Public methodTrySetApartmentStateSets the apartment state of a thread before it is started.
Public methodStatic memberVolatileReadOverloaded. Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache.
Public methodStatic memberVolatileWriteOverloaded. Writes a value to a field immediately, so that the value is visible to all processors in the computer.
Top
Properties

  NameDescription
Public propertyApartmentState Obsolete. Gets or sets the apartment state of this thread.
Public propertyStatic memberCurrentContextGets the current context in which the thread is executing.
Public propertyCurrentCultureGets or sets the culture for the current thread.
Public propertyStatic memberCurrentPrincipalGets or sets the thread's current principal (for role-based security).
Public propertyStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkCurrentThreadGets the currently running thread.
Public propertyCurrentUICultureGets or sets the current culture used by the Resource Manager to look up culture-specific resources at run time.
Public propertyExecutionContextGets an ExecutionContext object that contains information about the various contexts of the current thread.
Public propertyIsAliveGets a value indicating the execution status of the current thread.
Public propertySupported by the .NET Compact FrameworkSupported by the XNA FrameworkIsBackgroundGets or sets a value indicating whether or not a thread is a background thread.
Public propertyIsThreadPoolThreadGets a value indicating whether or not a thread belongs to the managed thread pool.
Public propertySupported by the .NET Compact FrameworkSupported by the XNA FrameworkManagedThreadIdGets a unique identifier for the current managed thread.
Public propertySupported by the .NET Compact FrameworkSupported by the XNA FrameworkNameGets or sets the name of the thread.
Public propertySupported by the .NET Compact FrameworkSupported by the XNA FrameworkPriorityGets or sets a value indicating the scheduling priority of a thread.
Public propertyThreadStateGets a value containing the states of the current thread.
Top
Explicit Interface Implementations

  NameDescription
Explicit interface implemetationPrivate method_Thread..::.GetIDsOfNamesMaps a set of names to a corresponding set of dispatch identifiers.
Explicit interface implemetationPrivate method_Thread..::.GetTypeInfoRetrieves the type information for an object, which can then be used to get the type information for an interface.
Explicit interface implemetationPrivate method_Thread..::.GetTypeInfoCountRetrieves the number of type information interfaces that an object provides (either 0 or 1).
Explicit interface implemetationPrivate method_Thread..::.InvokeProvides access to properties and methods exposed by an object.
Top
See Also

Reference

Tags :


Community Content

Thomas Lee
Parallel Framework (task parallelism) instead of plain threading
Instead of using plain threading to develop concurrent software, please also consider task parallelism.

Please read the following articles:
http://blog.rednael.com/2009/02/05/ParallelProgrammingUsingTheParallelFramework.aspx
http://blog.rednael.com/2009/03/16/ParallelFrameworkDownloadAndSupport.aspx

These are articles about basic parallel programming. Examples in C# .Net included. Also, it describes a lightweight parallel framework to work with tasks. Opposed to some other frameworks, this one is very light and very easy to use.
After reading this article, you should be able to write code using parallelism.

Regards,
Martijn
Tags : threading

Page view tracker