Tilde Friends
Task Stub

Typedefs

typedef int taskid_t
 
typedef struct _tf_packetstream_t tf_packetstream_t
 
typedef struct _tf_task_t tf_task_t
 
typedef struct _tf_taskstub_t tf_taskstub_t
 

Functions

void tf_taskstub_startup ()
 
JSValue tf_taskstub_register (JSContext *context)
 
taskid_t tf_taskstub_get_id (const tf_taskstub_t *stub)
 
JSValue tf_taskstub_get_task_object (const tf_taskstub_t *stub)
 
tf_packetstream_ttf_taskstub_get_stream (const tf_taskstub_t *stub)
 
tf_task_ttf_taskstub_get_owner (const tf_taskstub_t *stub)
 
tf_taskstub_ttf_taskstub_create_parent (tf_task_t *task, uv_file file)
 
void tf_taskstub_on_error (tf_taskstub_t *stub, JSValue error)
 
void tf_taskstub_on_print (tf_taskstub_t *stub, JSValue arguments)
 

Detailed Description

Task Stub is a poorly-named representation of a remote Task that can be exposed to JS.

Typedef Documentation

◆ taskid_t

typedef int taskid_t

A task identifier.

◆ tf_packetstream_t

typedef struct _tf_packetstream_t tf_packetstream_t

A packet stream.

◆ tf_task_t

typedef struct _tf_task_t tf_task_t

A task.

◆ tf_taskstub_t

typedef struct _tf_taskstub_t tf_taskstub_t

A handle to another task.

Function Documentation

◆ tf_taskstub_create_parent()

tf_taskstub_t * tf_taskstub_create_parent ( tf_task_t task,
uv_file  file 
)

Create a task stub representing the parent task of the running process.

Parameters
taskThe running task.
fileA file descriptor of a pipe connected to a parent process task.
Returns
The created task stub.

◆ tf_taskstub_get_id()

taskid_t tf_taskstub_get_id ( const tf_taskstub_t stub)

Get a unique identifier for the task stub.

Parameters
stubThe task stub.
Returns
An identifier for the stub.

◆ tf_taskstub_get_owner()

tf_task_t * tf_taskstub_get_owner ( const tf_taskstub_t stub)

Get the task owning the task stub.

Parameters
stubThe task stub.
Returns
The task from which the task stub was created.

◆ tf_taskstub_get_stream()

tf_packetstream_t * tf_taskstub_get_stream ( const tf_taskstub_t stub)

Get the packet stream that can be used to communicate with the task stub.

Parameters
stubThe task stub.
Returns
The packet stream.

◆ tf_taskstub_get_task_object()

JSValue tf_taskstub_get_task_object ( const tf_taskstub_t stub)

Get the JS object representing the task stub.

Parameters
stubThe task stub.
Returns
The JS object.

◆ tf_taskstub_on_error()

void tf_taskstub_on_error ( tf_taskstub_t stub,
JSValue  error 
)

Report an error to a task stub.

Parameters
stubThe stub to which to report th eerror.
errorThe error to report.

◆ tf_taskstub_on_print()

void tf_taskstub_on_print ( tf_taskstub_t stub,
JSValue  arguments 
)

Print to a task stub.

Parameters
stubThe task stub to which to print.
argumentsThe values to print.

◆ tf_taskstub_register()

JSValue tf_taskstub_register ( JSContext context)

Register the task stub script interface.

Parameters
contextThe JS context.
Returns
The task stub constructor.

◆ tf_taskstub_startup()

void tf_taskstub_startup ( )

Initialize task stub. Call before using the rest.