| Customize Help
| Save Settings

MthrControl



Function Map
Synopsis
Control a MIL thread context, MIL event, or MIL mutex setting.
Syntax
void MthrControl(
MIL_ID ThreadEventOrMutexId, //in
MIL_INT64 ControlType, //in
MIL_DOUBLE ControlValue //in
)
Description

This function controls a MIL thread context, MIL event, or MIL mutex setting. Most of these control type settings can be inquired using MthrInquire().

Note that when using a C compiler (not a C++ or other compiler) in 64-bit mode, MthrControl() internally calls the MIL_INT64 version of this function (MthrControlInt64()). If you need to pass floating-point values, call the MIL_INT64 version of this function (MthrControlDouble()).
Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
ThreadEventOrMutexId

Specifies the identifier of a user-allocated MIL thread context, event, or mutex, allocated using MthrAlloc(). This parameter can also be set to the MIL identifier of a system.

function map For specifying the identifier of a user-allocated MIL thread context, event, or mutex
Click to summarizeValue Description
Click to summarize M_DEFAULT

Specifies the default MIL thread context identifier associated with the current Host thread.

Click to summarize MIL event identifier

Specifies the identifier of a user-allocated MIL event (MthrAlloc()).

Click to summarize MIL mutex identifier

Specifies the identifier of a user-allocated MIL mutex (MthrAlloc()).

Click to summarize MIL system identifier

Specifies the identifier of a valid system identifier (MsysAlloc()).

When the parameter is set to the MIL identifier of a system, the function inquires about the current thread on the particular system.

(summarize)
Click to summarize MIL thread context identifier

Specifies the identifier of a user-allocated MIL thread context (MthrAlloc()).

ControlType

Specifies the type of setting to control.

See the Parameter associations section for possible values that can be specified.

ControlValue

Specifies the new value to assign to the setting specified by the ControlType parameter.

See the Parameter associations section for possible values that can be specified.

The tables below list possible values for the ControlType and ControlValue parameters.

The following ControlType and corresponding ControlValue settings can be specified to control MIL thread contexts:

function map For thread contexts
Click to summarizeControlType Description MIL system-specific
tooltip (‡)
ControlValue
Click to summarize M_ACCELERATOR

Sets whether the thread uses hardware acceleration. Hardware acceleration speeds up the execution of certain functions in a thread. Use MsysInquire() with M_ACCELERATOR_PRESENT to learn if your Matrox imaging board has an accelerator. INQ

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_DISABLE

Specifies not to use hardware acceleration.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_ENABLE

Specifies to use hardware acceleration.

This is the default value.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_BUS_MASTER_COPY_MODE

Sets the synchronization mode for copy operations when they are driven by your imaging board (bus master). In this case, the current setting for M_THREAD_MODE does not effect the synchronization mode. INQ

(summarize)
g h i j k
M10
l m p r
U27
u
U36
y
U75
aa
Click to summarize M_DEFAULT

Same as M_SYNCHRONOUS.

g h i j k
M10
l m p r
U27
u
U36
y
U75
aa
Click to summarize M_ASYNCHRONOUS

Specifies that when possible, control will be returned to the imaging board (bus master) immediately after a copy operation is launched.

g h i j k
M10
l m p r
U27
u
U36
y
U75
aa
Click to summarize M_SYNCHRONOUS

Specifies that the execution of a copy operation must be completed before returning control to the imaging board (bus master).

g h i j k
M10
l m p r
U27
u
U36
y
U75
aa
Click to summarize M_NODE_SELECT

Sets the MIL system where MIL functions will run in the thread, when running multiple systems in DMIL.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_DEFAULT

Specifies that the MIL system on which the MIL functions will run is selected automatically.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize MIL system identifier

Specifies a valid system identifier, which forces all MIL functions to run on this system.

When running a monitoring model DMIL setup, to specify that MIL functions must run on a monitored computer, the monitored computer must first publish its system identifier, using MobjControl(). Once the system identifier is published, the monitoring computer must inquire it, using MobjInquire(), before using it with this control value.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_THREAD_COMMANDS_ABORT

Cancels all calls queued in the thread. The remainder of the application is executed.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_DEFAULT

Implements the default behavior.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_THREAD_MODE

Sets the execution mode of the thread.

Note that a thread can only work in asynchronous mode if threads allocated on the same system can execute in asynchronous mode (MsysControl() with M_THREAD_MODE). If they can only execute in synchronous mode, the specified thread will work in synchronous mode regardless of this setting. INQ

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
MIL system specific

Note that the specified synchronization mode does not affect copy operations. Use M_BUS_MASTER_COPY_MODE to specify the required mode for copying.

g h l m
Click to summarize M_DEFAULT

Same as M_ASYNCHRONOUS.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_ASYNCHRONOUS

Specifies that the thread will execute in asynchronous mode, if possible. In this mode, control is returned to the Host immediately after a MIL function is sent to the processor of the thread's associated system (when the system and function allow an immediate return).

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_SYNCHRONOUS

Specifies that the thread will execute in synchronous mode. In this mode, the execution of a MIL function sent to the processor of the thread's associated system must be completed (execution terminated) before returning control to the Host.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_THREAD_PRIORITY

Sets the priority status of the thread. INQ

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_ABOVE_NORMAL

Specifies that the thread is above normal priority. Only time critical threads will be executed before it.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_BELOW_NORMAL

Specifies that the thread is below normal priority. Threads of normal, above normal, and time critical priority will be executed before it.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_IDLE

Specifies that the thread is idle. The thread will remain idle until its priority status is changed.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_LOWEST

Specifies that the thread is of the lowest priority. All other non-idle threads will be executed before it.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_NORMAL

Specifies that the thread is of normal priority. Threads of above normal and time critical priority will be executed before it.

This is the default value.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_TIME_CRITICAL

Specifies that the thread is time critical. Time critical threads will be executed before all other threads that are not time critical.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_THREAD_SELECT

Sets the selectable thread, specified by the ThreadEventOrMutexId parameter, as the destination for subsequent MIL functions. This allows MIL functions to be executed on systems with on-board processors.

Before calling MthrControl() with M_THREAD_SELECT you should inquire and save the identifier of the on-board thread that is by default associated with the Host thread, using MsysInquire() with M_CURRENT_THREAD_ID. This allows you to return control to this on-board thread.

If the ThreadEventOrMutexId parameter is set to an identifier of a thread that is not selectable, changing the settings of this control will generate an error.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa
Click to summarize M_DEFAULT

Implements the default behavior.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v w
U53
y
U75
z aa

The following ControlType and corresponding ControlValue setting can be specified to control MIL events:

function map For controlling MIL events
Click to summarizeControlType Description
ControlValue
Click to summarize M_EVENT_SET

Sets an event to the specified state. INQ

(summarize)
Click to summarize M_NOT_SIGNALED

Sets the event to the not-signaled state.

Click to summarize M_SIGNALED

Sets the event to the signaled state.

The following ControlType and corresponding ControlValue setting can be specified to control a MIL mutex:

function map For controlling a MIL mutex
Click to summarizeControlType Description
ControlValue
Click to summarize M_LOCK

Forces the current thread to wait until the specified MIL mutex is available and then locks it. Locking the mutex blocks all other threads from accessing the current critical section of code.

Note that the current thread can lock the same mutex several times without an error occurring. However, the current thread must unlock (M_UNLOCK) the mutex as many times as it was locked. For example, if the current thread previously locked the mutex twice, the mutex must be unlocked twice after the critical section of code has completed.

(summarize)
Click to summarize M_DEFAULT

Specifies the default behavior.

Click to summarize M_LOCK_TRY

Locks the specified MIL mutex if it is currently unlocked. Locking the mutex blocks all other threads from accessing the current critical section of code.

If the mutex is locked by another thread, M_LOCK_TRY does not force the thread to wait for the mutex to become unlocked; the thread continues executing without executing the critical section of code protected by the mutex.

To determine whether the current thread has successfully locked the mutex, use MthrInquire() with M_LOCK_TRY.

(summarize)
Click to summarize M_DEFAULT

Implements the default behavior.

Click to summarize M_UNLOCK

Unlocks the specified mutex.

(summarize)
Click to summarize M_DEFAULT

Implements the default behavior.

Type-specific versions of the function when using a C compiler under 64-bit
void MthrControlDouble (MIL_ID ThreadEventOrMutexId, MIL_INT64 ControlType, MIL_DOUBLE ControlValue)
Parameters

ThreadEventOrMutexId

See ThreadEventOrMutexId of the main function for a description.

ControlType

See ControlType of the main function for a description.

ControlValue

See ControlValue of the main function for a description.

void MthrControlInt64 (MIL_ID ThreadEventOrMutexId, MIL_INT64 ControlType, MIL_INT64 ControlValue)
Parameters

ThreadEventOrMutexId

See ThreadEventOrMutexId of the main function for a description.

ControlType

See ControlType of the main function for a description.

ControlValue

See ControlValue of the main function for a description.

Compilation information
Header Include mil.h.
Library Use mil.lib.
DLL Requires mil.dll.
DEFAULT ACCELERATOR DISABLE ENABLE BUS MASTER COPY MODE DEFAULT ASYNCHRONOUS SYNCHRONOUS NODE SELECT DEFAULT THREAD COMMANDS ABORT DEFAULT THREAD MODE DEFAULT ASYNCHRONOUS SYNCHRONOUS THREAD PRIORITY ABOVE NORMAL BELOW NORMAL IDLE LOWEST NORMAL TIME CRITICAL THREAD SELECT DEFAULT EVENT SET NOT SIGNALED SIGNALED LOCK DEFAULT LOCK TRY DEFAULT UNLOCK DEFAULT