Table of Contents

Name

tsci2_init, tsci2_shutdown - initialize and shut down tsci2 library.

Synopsis

#include <tsci2.h>

int tsci2_init(int methods);

int tsci2_shutdown();

Description

The tsci2_init() function initializes the tsci2 library and the tsci2_shutdown function shuts it down. The initialization will return the current available method, depending on the user preference, access priviledge and whether there is tsci2d timekeeping daemon running.

The methods argument designates user’s preference of timekeeping methods and could be any combination of TSCI2_DAEMON, TSCI2_CLIENT and TSCI2_FALLBACK. tsci2_init will try best to find a match.

If the current available timekeeping method is TSCI2_DAEMON, tsci2_init() will set up shared memory communication with daemon. tsci2_shutdown() will unmap the shared memory.

Return Values

Upon successful completion, tsci2_init() returns the current available method and tsci2_shutdown returns 0. Otherwise, TSCI2_ERROR is returned.

Examples

The following code shows how to use tsci2_init() and tsci2_shutdown().

#include <stdio.h>

#include <tsci2.h>

int main(int argc, char **argv) {

int preferred_methods, method;

preferred_methods = TSCI2_DAEMON | TSCI2_FALLBACK;

method = tsci2_init(preferred_methods);

if ( method == TSCI2_ERROR )

printf("Error initializing tsci2 library!\n");

tsci2_shutdown();

}

Author

Xun Luo (sherwoodluo@users.sourceforge.net)

See Also

tsci2d(8) , tsci2demo(1) , tsci2measure(1) , tsci2_alloc_context(3) , tsci2_free_context(3) , tsci2_get_default_context(3) , tsci2_gettimeofday(3) , tsci2_getticks(3) , tsci2_ticks2timeval(3) .


Table of Contents