libosip  4.1.0
How-To handle portability.

Time

The libosip2 library also offer high portability through a common API for conditions variables, fifos, threads, mutex and semaphore: all you need to write portable applications.

The target and active development platforms are: linux, windows, macosx, android and iOS. Those platforms are tested every day and you can use the git repository without fear!

Additionnaly, wince, windows mobile, vxworks, unix, linux on arm -and more- have been also tested regularly. If you have troubles for some system, please ask the mailing list (osip-.nosp@m.dev@.nosp@m.gnu.o.nosp@m.rg)

#include <osip2/osip_mt.h>
#include <osip2/osip_time.h>

Time

void *_my_thread (void *arg)
{
struct sometype_t *excontext = (struct sometype_t *) arg;
int i;
while (stopthread == 0) {
do_actions (excontext);
}
return NULL;
}
struct osip_thread *thread;
thread = osip_thread_create (20000, _my_thread, argpointer);
i = osip_thread_join (thread);
osip_free (thread);

Time

struct osip_mutex *mutex;
mutex = osip_mutex_init ();
do_actions ();

Time

libosip2 is also providing a common time API.

This is usefull to implement in various way a CLOCK_MONOTONIC time and make time adjustement when a drift is discovered against realtime clock.

Note: It is required to call osip_compensatetime on Android which goes regularly into deep sleep mode. When this happens, the MONOTONIC clock is not increasing. This may also happen for other OS as well.

int osip_gettimeofday (struct timeval *tp, void *tz);
void osip_compensatetime ();