| 1 | = Options and status APIs = |
| 2 | |
| 3 | == Setting options == |
| 4 | |
| 5 | The BOINC API provides a number of functions, and in developing a compound application you must decide whether these functions are to be performed by the main or worker program. The functions are represented by flags in the BOINC_OPTIONS structure. Each flag must be set in either the main or worker programs, but not both. |
| 6 | |
| 7 | |
| 8 | {{{ |
| 9 | struct BOINC_OPTIONS { |
| 10 | int main_program; |
| 11 | int check_heartbeat; |
| 12 | int handle_trickle_ups; |
| 13 | int handle_trickle_downs; |
| 14 | int handle_process_control; |
| 15 | int handle send_status_msgs; |
| 16 | int direct_process_action; |
| 17 | }; |
| 18 | |
| 19 | int boinc_init_options(BOINC_OPTIONS*); |
| 20 | }}} |
| 21 | |
| 22 | |
| 23 | '''main_program''':: |
| 24 | Set this in the main program. |
| 25 | '''check_heartbeat''':: |
| 26 | If set, the program monitors 'heartbeat' messages from the core client. If the heartbeat stops, the result depends on the direct_process_action flag (see below). |
| 27 | '''handle_trickle_ups''':: |
| 28 | If set, the program can send trickle-up messages. |
| 29 | '''handle_trickle_downs''':: |
| 30 | If set, the program can receive trickle-down messages. |
| 31 | '''handle_process_control''':: |
| 32 | If set, the program will handle 'suspend', 'resume', and 'quit' messages from the core client. The action depends on the direct_process_action flag. |
| 33 | '''send_status_msgs''':: |
| 34 | If set, the program will report its CPU time and fraction done to the core client. Set in worker programs. |
| 35 | '''direct_process_action''':: |
| 36 | If set, the program will respond to quit messages and heartbeat failures by exiting, and will respond to suspend and resume messages by suspending and resuming. Otherwise, these events will result in changes to the BOINC_STATUS structure, which can be polled using boinc_get_status(). |
| 37 | '''all_threads_cpu_time''':: |
| 38 | If set, the CPU of all threads (not just the worker thread) will be counted. For apps that do computation in more than one thread. |