Changes between Version 19 and Version 20 of BasicApi
- Timestamp:
- May 12, 2009, 9:23:49 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
BasicApi
v19 v20 1 1 [[PageOutline]] 2 2 = The BOINC application programming interface (API) = 3 4 3 5 4 The BOINC API is a set of C++ functions. Most of the functions have a C interface, so that they can be used from programs written in C and other languages. Unless otherwise specified, the functions return an integer error code; zero indicates success. … … 9 8 BOINC applications may consist of several programs that are executed in sequence; these are called compound applications. See the [CompoundApps compound application API]. 10 9 11 == Initialization and termination == 10 == Initialization and termination == #init 12 11 13 12 Initialization for graphical and compound applications are described elsewhere (see links above). Other applications must call … … 29 28 `status` is nonzero if an error was encountered. This call does not return. 30 29 31 == Resolving file names == 30 == Resolving file names == #filenames 32 31 33 32 Applications that use named input or output files must call … … 64 63 `boinc_resolve_filename()` doesn't need to be used for temporary files. 65 64 66 == I/O wrappers == 65 == I/O wrappers == #fopen 67 66 68 67 Applications should replace `fopen()` calls with … … 75 74 This deals with platform-specific problems. On Windows, where security and indexing programs can briefly lock files, `boinc_fopen()` does several retries at 1-second intervals. On Unix, where signals can cause `fopen()` to fail with `EINTR`, `boinc_fopen` checks for this and does a few retries; it also sets the 'close-on-exec' flag. 76 75 77 == Checkpointing == 76 == Checkpointing == #checkpointing 78 77 79 78 Computations that use a significant amount of time per work unit may want to periodically write the current state of the computation to disk. This is known as '''checkpointing'''. The state file must include everything required to start the computation again at the same place it was checkpointed. On startup, the application reads the state file to determine where to begin computation. If the BOINC client quits or exits, the computation can be restarted from the most recent checkpoint. … … 110 109 and do a srand(x) when restarting from a checkpoint. 111 110 112 == Critical sections == 111 == Critical sections == #critical_sections 113 112 114 113 {{{ … … 160 159 This lets the application report the total number of floating-point and/or integer operations since the start of the result. If `floating_point_ops` is nonzero, it's used to compute credit and `integer_ops` is ignored. `boinc_ops_cumulative()` may be called multiple times, but only the last call makes any difference. 161 160 162 == Reporting progress == 161 == Reporting progress == #progress 163 162 164 163 The core client GUI displays the percent done of workunits in progress. To keep this display current, an application should periodically call … … 256 255 to get its total CPU time (from the beginning of the work unit, not just since the last restart). This excludes CPU time used to render graphics. 257 256 258 == Is your application running standalone? ==257 == Standalone mode == #standalone 259 258 260 259 BOINC applications can be run in "standalone" mode for testing, or under the control of the BOINC client. You might want your application to behave differently in the two cases. For example you might want to output debugging information if the application is running standalone. To determine if the application is running in standalone mode or under the control of the BOINC client, call … … 267 266 This returns non-zero (True) if the application is running standalone, and zero (False) if the application is running under the control of the BOINC client. 268 267 269 == Registering a timer handler == 268 == Registering a timer handler == #timer 270 269 271 270 {{{ … … 278 277 which will be called once per second. 279 278 280 == Requesting network connection == 279 == Requesting network connection == #network 281 280 282 281 If your application needs to do network communication and it appears that there is no physical network connection (e.g. `gethostbyname()` fails for a valid name) then: