| 21 | | To initialize a single-thread program, call |
| 22 | | {{{ |
| 23 | | #!c++ |
| 24 | | int boinc_init(); |
| 25 | | }}} |
| 26 | | |
| 27 | | To initialize a multi-thread program, call |
| 28 | | {{{ |
| 29 | | #!c++ |
| 30 | | int boinc_init_parallel(); |
| 31 | | }}} |
| 32 | | |
| 33 | | Note that `boinc_init_parallel` will `fork` on Unix systems, |
| 34 | | so you must not create any thread or try to store the current PID |
| 35 | | before calling this function. |
| 36 | | If this function succeeds, |
| 37 | | the parent (original) process will run an internal loop, |
| 38 | | and will not return; |
| 39 | | code following the `boinc_init_parallel` call will run in the child process. |
| | 17 | {{{ |
| | 18 | BOINC_OPTIONS options; |
| | 19 | |
| | 20 | boinc_options_defaults(options); |
| | 21 | options.multi_thread = true; // include this if your app's main process uses multiple threads |
| | 22 | options.multi_process = true; // include this if your app uses multiple processes |
| | 23 | |
| | 24 | boinc_init_options(&options); |
| | 25 | }}} |
| | 26 | |
| | 27 | Do not create any threads or store the current PID |
| | 28 | before calling '''boinc_init_options()'''. |