IOCommandGate



Member Functions

checkForWork

Abstract: Not used, $link IOEventSource::checkForWork().
protected:

virtual bool checkForWork();


commandGate

Abstract: Factory method to create and initialise an IOCommandGate, See $link init.
public:

static IOCommandGate *commandGate(OSObject *owner, Action action = 0);

Result: Returns a pointer to the new command gate if sucessful, 0 otherwise.

init

Abstract: Class initialiser.
public:

virtual bool init(OSObject *owner, Action action = 0);

Initialiser for IOCommandGate operates only on newly 'newed' objects. Shouldn't be used to re-init an existing instance.

Parameters

NameDescription
ownerOwner of this, newly created, instance of the IOCommandGate. This argument will be used as the first parameter in the action callout.
actionPointer to a C function that is called whenever a client of the IOCommandGate calls runCommand. NB Can be a C++ member function but caller must cast the member function to $link IOCommandGate::Action and they will get a compiler warning. Defaults to zero, see $link IOEventSource::setAction.
Result: True if inherited classes initialise successfully.

runAction

Abstract: Single thread a call to an action with the target work-loop.
public:

virtual IOReturn runAction(Action action, void *arg0 = 0, void *arg1 = 0, void *arg2 = 0, void *arg3 = 0);

Client function that causes the given action to be called in a single threaded manner. Beware the work-loop's gate is recursive and command gates can cause direct or indirect re-entrancy. When the executing on a client's thread runCommand will sleep until the work-loop's gate opens for execution of client actions, the action is single threaded against all other work-loop event sources.

Parameters

NameDescription
actionPointer to function to be executed in work-loop context.
arg0Parameter for action of command gate, defaults to 0.
arg1Parameter for action of command gate, defaults to 0.
arg2Parameter for action of command gate, defaults to 0.
arg3Parameter for action of command gate, defaults to 0.
Result: kIOReturnSuccess if successful. kIOReturnBadArgument if action is not defined, kIOReturnNoResources if no action available.

runCommand

Abstract: Single thread a command with the target work-loop.
public:

virtual IOReturn runCommand(void *arg0 = 0, void *arg1 = 0, void *arg2 = 0, void *arg3 = 0);

Client function that causes the current action to be called in a single threaded manner. Beware the work-loop's gate is recursive and command gates can cause direct or indirect re-entrancy. When the executing on a client's thread runCommand will sleep until the work-loop's gate opens for execution of client actions, the action is single threaded against all other work-loop event sources.

Parameters

NameDescription
arg0Parameter for action of command gate, defaults to 0.
arg1Parameter for action of command gate, defaults to 0.
arg2Parameter for action of command gate, defaults to 0.
arg3Parameter for action of command gate, defaults to 0.
Result: kIOReturnSuccess if successful. kIOReturnNotPermitted if this event source is currently disabled, kIOReturnNoResources if no action available.

Member Data

Action

public:typedef IOReturn (*Action)(OSObject *owner, void *arg0, void *arg1, void *arg2, void *arg3);

Type and arguments of callout C function that is used when a runCommand is executed by a client. Cast to this type when you want a C++ member function to be used. Note the arg1 - arg3 parameters are straight pass through from the runCommand to the action callout.

Parameters

NameDescription
ownerTarget of the function, can be used as a refcon. The owner is set during initialisation of the IOCommandGate instance. Note if a C++ function was specified this parameter is implicitly the first paramter in the target member function's parameter list.
arg0Argument to action from run operation.
arg1Argument to action from run operation.
arg2Argument to action from run operation.
arg3Argument to action from run operation.

© 2000 Apple Computer, Inc. — (Last Updated 2/23/2000)