Thread
exposes a useful API for managing the state of processes created from cluster.fork()
Static Member Summary
Static Public Members | ||
public static get |
the key definition that stores the business of a <Process> |
Static Method Summary
Static Public Methods | ||
public static |
Generates a new Thread instance |
|
public static |
free(thread: Process): Process sets the |
|
public static |
isAvailable(thread: Process): boolean Determine if a Thread is available. |
|
public static |
kill(process: Process): * Used by the Main process to kill a Thread |
|
public static |
reserve(thread: Process): Process sets the |
|
public static |
forks a new Thread for the cluster.Master <Process:Main> to use |
Constructor Summary
Public Constructor | ||
public |
generates a new Thread instance when |
Member Summary
Public Members | ||
public |
debug: * |
Method Summary
Public Methods | ||
public |
done(id: <type>, result: <type>) Convience wrapper for emitting successful <Job> completion |
|
public |
Emits a namespaced <Event> back to <Process:Main> |
|
public |
Convenience wrapper for Thread.prototype.emit(Thread.Event.Error, <Error>) |
|
public |
invalidate(script: String) invalidates the local require cache for a particular script |
|
public |
The runtime wrapper for a <Job> |
|
public |
Checks the integrity of a <Job> before a <Thread> attempts to process it |
Static Public Members
Static Public Methods
public static free(thread: Process): Process source
sets the BUSY_SWITCH
to false for a given <Process>
Params:
Name | Type | Attribute | Description |
thread | Process | The thread to free |
Return:
Process |
public static isAvailable(thread: Process): boolean source
Determine if a Thread is available.
Params:
Name | Type | Attribute | Description |
thread | Process | The thread |
public static kill(process: Process): * source
Used by the Main process to kill a Thread
Params:
Name | Type | Attribute | Description |
process | Process | The process to kill |
Return:
* |
public static reserve(thread: Process): Process source
sets the BUSY_SWITCH
to true for a given <Process>
Params:
Name | Type | Attribute | Description |
thread | Process | The thread to reserve |
Return:
Process |
Public Constructors
Public Members
public debug: * source
Public Methods
public done(id: <type>, result: <type>) source
Convience wrapper for emitting successful <Job> completion
Params:
Name | Type | Attribute | Description |
id | <type> | the <Job:id> that should be associated with the <Result> |
|
result | <type> | The result of <Job> |
public emit(namespace: String, data: Object): Thread source
Emits a namespaced <Event> back to <Process:Main>
public error(id: String, err: Error): Thread source
Convenience wrapper for Thread.prototype.emit(Thread.Event.Error, <Error>)
public invalidate(script: String) source
invalidates the local require cache for a particular script
Params:
Name | Type | Attribute | Description |
script | String | The absolute path of the script |