Start

nn::boss::Task::Start Member Function

Syntax

nn::Result Start(
     void
);

Parameters

None.

Return Values

Returns the function's execution result. Returns one of the Result values listed below.

Value Description
Result::IsSuccess Successfully issued the instruction to start the task.
ResultInvalidTaskId The task ID pointer is NULL or a zero-length string.
ResultTaskNotExist The specified task ID was not found. Confirm whether it is registered yet.
ResultIpcNotSessionInitialized The session has not been initialized. This result is returned if this function is called before the Initialize function. Always call the Initialize function before you use the BOSS library.
A value other than the above. Unexpected error (see boss_Result.h for error details).

Description

Gives an instruction to start the task.

Scheduled tasks run automatically in the background whenever infrastructure connections are possible. Except for the first time a task is run, this function behaves the same as the StartBgImmediate function. The first time a task is run, this function runs after waiting for the task execution interval.
With the StartBgImmediate function, the first task is executed immediately after implementation of the function's infrastructure connection, because the behavior is set to synchronize the timing of the first task's execution along with the implementation of the function.

When a task finishes running, the execution count specified in the task's attributes is decremented by 1 regardless of whether task execution resulted in an error. Unless this results in a remaining execution count of 0, the task will run again after the execution interval specified in the task's attributes has elapsed.
Note:After its execution count reaches zero, a task is sometimes deleted automatically if the internal database is filled to capacity.

Note: In the following circumstances, tasks won't be executed even if the instruction is issued to start a task.
• The task's execution count is 0.
• The task's execution priority is PRIORITY_STOPPED.
• Parental Controls are in effect and are not disabled by the task attributes.
• The user has not yet agreed to the EULA, and the requirement to agree to the EULA is not disabled by the task attributes.
• Task execution was stopped by the policy list.
• The server hosting the download service issued a "service suspended" notice.
• The administrator has temporarily stopped all tasks.

The GetCount function can be used to confirm whether the task execution count is the relevant case among those listed above. You can tell when the administrator has temporarily stopped all tasks because TASK_PAUSED is returned by the GetState function for all running tasks.

The following methods can be used to wait for task completion.
・Wait for execution to complete with using WaitFinish function.
・Specify a maximum waiting time and wait for execution to complete using the WaitFinish function.
・Use the GetState function to poll for completed tasks.
・Wait for a "new arrival" event using an Event registered by the RegisterNewArrivalEvent function.

Once you detect that a task has completed, you can check its state using the GetState function, its execution result code using the GetResult function, and the HTTP communication result code using the GetHttpStatusCode function. You can also get other details with the GetStateDetail function.

Revision History

2010/09/16
Initial version.

CONFIDENTIAL