\n
Microsoft Invisible Computing

IThread Interface

The IThread interface provides a method for accessing the process in which the thread was started and the run-time library provides a function for accessing the current thread.

C type for interface pointer:

Extends IUnknown

Implemented by CThread

See also CurrentThread

Methods: GetProcess StartWithConstraint GetValue SetValue

Constants: _CRITICALITY THREAD_VALUE

Structs: TIME_CONSTRAINT

Methods

GetProcess

Gets a pointer to the process object that the thread runs in.

StartWithConstraint

Get partially initialized thread going.

GetValue

Get the previous value set by IThread.SetValue.

SetValue

Set a thread-specific variable that can be retrieved through IThread.GetValue.

Constants

_CRITICALITY

In a time constraint, specify whether the work is mission critical or not. In most cases the value should be set to _NONCRITICAL.

THREAD_VALUE

Predefined per-thread variable indexes.

Structs

TIME_CONSTRAINT

A scheduling time constraint.

IThread.GetProcess Method

Gets a pointer to the process object that the thread runs in.

SCODE GetProcess( 
    /*in,this*/ PITHREAD iThis,
    /*out*/ PIPROCESS * ppIProcess)
ppIProcess

The process pointer is returned here.

C++

SCODE IThread::GetProcess( 
    /*out*/ PIPROCESS * ppIProcess)

IThread.StartWithConstraint Method

Get partially initialized thread going.

SCODE StartWithConstraint( 
    /*in,this*/ PITHREAD iThis,
    /*in,optional*/ PTIME_CONSTRAINT pcval,
    /*in*/ THREAD_FUNCTION pStart,
    /*in*/ THREAD_ARGUMENT Arg,
    /*in,optional*/ PTR StackTop,
    /*in*/ UINT ArgCount)
pcval

Initial TIME_CONSTRAINT for thread. NULL for time sharing.

pStart

Specifies the address of the function to invoke as the starting point of the thread. See THREAD_FUNCTION.

Arg

Specifies the address of the parameter passed to the thread. See THREAD_ARGUMENT When StackTop is not NULL this is instead used as the function address where to return once pStart finishes.

StackTop

Stacktop to load (as returned by IProcess.CreateThread.pStackTop). When NULL, the current thread stack is used. When not NULL, it is assumed the caller already setup the regular stack and consequently Arg will be ignored.

ArgCount

Number of arguments that are on stack, when StackTop is set.

C++

SCODE IThread::StartWithConstraint( 
    /*in,optional*/ PTIME_CONSTRAINT pcval,
    /*in*/ THREAD_FUNCTION pStart,
    /*in*/ THREAD_ARGUMENT Arg,
    /*in,optional*/ PTR StackTop,
    /*in*/ UINT ArgCount)

IThread.GetValue Method

Get the previous value set by IThread.SetValue.

UINT GetValue( 
    /*in,this*/ PITHREAD iThis,
    /*in*/ THREAD_VALUE Index)
Index

Which value to get.

C++

UINT IThread::GetValue( 
    /*in*/ THREAD_VALUE Index)

IThread.SetValue Method

Set a thread-specific variable that can be retrieved through IThread.GetValue.

void SetValue( 
    /*in,this*/ PITHREAD iThis,
    /*in*/ THREAD_VALUE Index,
    /*in*/ UINT Value)
Index

Which value to set.

Value

The value that may be retrieved through GetValue.

C++

void IThread::SetValue( 
    /*in*/ THREAD_VALUE Index,
    /*in*/ UINT Value)

_CRITICALITY Constant

In a time constraint, specify whether the work is mission critical or not. In most cases the value should be set to _NONCRITICAL.

Underlying C type:

_NONCRITICAL 0x0

Normal work. Overload results in error code returned by EndConstraint.

_CRITICAL 0x1

Mission critical. Any failure to complete work as specified indicates fatal failure and results in a reset.

_TIMESHARING 0x2

Same as noncritical, but meant to equally share available CPU time with other timesharing threads.

In the current implementation the _CRITICALITY value has very little impact.

THREAD_VALUE Constant

Predefined per-thread variable indexes.

Underlying C type:

THREAD_VALUE_LAST_ERROR 0x0

Implements functionality to Get/SetLastError.

NOTE:Deprecated: rather return an explicit SCODE from method/function.
THREAD_VALUE_RPC_CONTINUATION 0x1

State for post-processing service request.

THREAD_VALUE_SCHED_BAR 0x2

Currently associated scheduling object.

TIME_CONSTRAINT Structure

A scheduling time constraint.

See also Time Management method group Scheduling white paper. _CRITICALITY

Fields
Start
C/C++ type: TIME

The earliest allowed start time.

The invoking thread will block until the time has arrived. If the start time is in the past the thread will not block (unless preempted by other threads). Time can be relative (negative) or absolute (positive). If the time is relative the thread will be blocked for that long from now. Zero means immediate.

Estimate
C/C++ type: TIME

Estimate of required execution time.

The estimate can be tuned according to the feedback provided by EndConstraint.

Deadline
C/C++ type: TIME

The latest allowed time the work must be completed by.

Criticality
C/C++ type: _CRITICALITY

Whether the job is mission critical or not.

TimeTaken
C/C++ type: PTIME

Pointer to a TIME to store the elapsed running time, if desired. Otherwise, set to NULL.

2006 Microsoft Corporation. All rights reserved. Terms of Use Privacy Statement Accessibility End User License Agreement