Changes between Version 19 and Version 20 of BasicApi


Ignore:
Timestamp:
May 12, 2009, 9:23:49 AM (15 years ago)
Author:
Nicolas
Comment:

Changed a heading and added explicit anchors to all

Legend:

Unmodified
Added
Removed
Modified
  • BasicApi

    v19 v20  
    11[[PageOutline]]
    22= The BOINC application programming interface (API) =
    3        
    43
    54The 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.
     
    98BOINC applications may consist of several programs that are executed in sequence; these are called compound applications. See the [CompoundApps compound application API].
    109
    11 == Initialization and termination ==
     10== Initialization and termination == #init
    1211
    1312Initialization for graphical and compound applications are described elsewhere (see links above). Other applications must call
     
    2928`status` is nonzero if an error was encountered. This call does not return.
    3029
    31 == Resolving file names ==
     30== Resolving file names == #filenames
    3231
    3332Applications that use named input or output files must call
     
    6463`boinc_resolve_filename()` doesn't need to be used for temporary files.
    6564
    66 == I/O wrappers ==
     65== I/O wrappers == #fopen
    6766
    6867Applications should replace `fopen()` calls with
     
    7574This 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.
    7675
    77 == Checkpointing ==
     76== Checkpointing == #checkpointing
    7877
    7978Computations 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.
     
    110109and do a srand(x) when restarting from a checkpoint.
    111110
    112 == Critical sections ==
     111== Critical sections == #critical_sections
    113112
    114113{{{
     
    160159This 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.
    161160
    162 == Reporting progress ==
     161== Reporting progress == #progress
    163162
    164163The core client GUI displays the percent done of workunits in progress. To keep this display current, an application should periodically call
     
    256255to 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.
    257256
    258 == Is your application running standalone? ==
     257== Standalone mode == #standalone
    259258
    260259BOINC 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
     
    267266This 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.
    268267
    269 == Registering a timer handler ==
     268== Registering a timer handler == #timer
    270269
    271270{{{
     
    278277which will be called once per second.
    279278
    280 == Requesting network connection ==
     279== Requesting network connection == #network
    281280
    282281If 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: