Skip to content

OptionsApi

Vitalii Koshura edited this page Apr 6, 2023 · 3 revisions

APIs for wrappers

Wrappers (wrapper, vboxwrapper, wrappture) perform the functions normally done by the BOINC runtime system, such as handling suspend/resume messages from the client. For example, vboxwrapper handles suspend messages by telling the VirtualBox hypervisor to suspend the VM.

Developing a wrapper involves:

  • Setting initialization options telling the BOINC runtime system what functions it should perform (i.e. those not performed by the wrapper).
  • Periodically calling boinc_get_status() to see when something (e.g. suspend/resume) needs to be done.

Initialization for wrappers

BOINC_OPTIONS options;

boinc_options_defaults(options);
options.main_program = true;
... set options
boinc_init_options(&options);
struct BOINC_OPTIONS {
    int normal_thread_priority;
    int multi_thread;
    int multi_process;
    int main_program;
    int check_heartbeat;
    int handle_process_control;
    int handle send_status_msgs;
    int direct_process_action;
};

The first three options are described here.

The remaining options determine what runtime system functions will be performed by this program. In developing a wrapper application you must decide whether these functions are to be performed by the main or worker program. Each flag must be set in either the main or worker programs, but not both.

main_program

Set this in the main program.

check_heartbeat

If set, the program monitors 'heartbeat' messages from the client. If the heartbeat stops, the result depends on the direct_process_action flag (see below).

handle_process_control

If set, the program will handle 'suspend', 'resume', and 'quit' messages from the client. The action depends on the direct_process_action flag.

send_status_msgs

If set, the program will report its CPU time and fraction done to the client. Set in worker programs.

direct_process_action

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().

Clone this wiki locally