Declares a new service.
a0tError || a0NewService( |
|| int || *service, |
|| a0tRemoteFunction || function,|
|| a0tScheduling || sched, |
|| int || prio, |
|| size_t || stack );
|service||write||Address of the service to set up.|
|function||read||Function to call at service activation.|
|sched||read||Default scheduling rule to be used .|
|prio||read||Default priority of the service thread.|
|stack||read||Default stack size of service thread.|
This function declares a function to be called remotely with a0StartRemoteThread() or a0StartRemoteUrgent() and creates a service descriptor to it. When this function is called by a0StartRemoteThread(), the values passed in sched, prio, and stack are the default values for the new service, concerning scheduling rule, priority and stack size, respectively. See A0DefaultScheduling, A0DefaultPriority and A0DefaultStack for the possible values.
When this function is called by a0StartRemoteUrgent(), the function registered will not be executed as a separate thread: all remote requests arriving at a node are executed by the same thread, sequentially. Thus, a function to be executed as a Remote Request should not block in any way. Other restrictions as to what this function can and can't do may appear later, as users report bugs...
The current implementation of this service declaration function relies that the user will call it only between a0Init() and a0InitCommit(), in the same order in every node that the program executes. After a0InitCommit(), all the Athapascan-0 daemons are already running and an error occurs if another node calls a0StartRemoteThread() to a service declared later.
The buffer passed to the service call will be received as the only parameter of the service function, so the service function passed as parameter should correspond to the following prototype:
On return of this function, the variable pointed by service contains a service descriptor that refers to the function passed.
A0Err...||Some error occurred.|
a0StartRemoteThread() a0StartRemoteUrgent() a0Init() a0InitCommit()