ht5-portability.dox (libosip2-5.0.0) | : | ht5-portability.dox (libosip2-5.1.0) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
have been also tested regularly. If you have troubles for some system, | have been also tested regularly. If you have troubles for some system, | |||
please ask the mailing list (osip-dev@gnu.org) | please ask the mailing list (osip-dev@gnu.org) | |||
~~~~~~~{.c} | ~~~~~~~{.c} | |||
#include <osip2/osip_mt.h> | #include <osip2/osip_mt.h> | |||
#include <osip2/osip_fifo.h> | #include <osip2/osip_fifo.h> | |||
#include <osip2/osip_condv.h> | #include <osip2/osip_condv.h> | |||
#include <osip2/osip_time.h> | #include <osip2/osip_time.h> | |||
~~~~~~~ | ~~~~~~~ | |||
* @section howto_portability1 Threads | * @section howto_portability2 Threads | |||
+ Here is code to show how to start a thread: | + Here is code to show how to start a thread: | |||
~~~~~~~{.c} | ~~~~~~~{.c} | |||
void *_my_thread (void *arg) | void *_my_thread (void *arg) | |||
{ | { | |||
struct sometype_t *excontext = (struct sometype_t *) arg; | struct sometype_t *excontext = (struct sometype_t *) arg; | |||
int i; | int i; | |||
while (stopthread == 0) { | while (stopthread == 0) { | |||
skipping to change at line 54 | skipping to change at line 54 | |||
thread = osip_thread_create (20000, _my_thread, argpointer); | thread = osip_thread_create (20000, _my_thread, argpointer); | |||
~~~~~~~ | ~~~~~~~ | |||
+ Here is code to show how to terminate a thread: | + Here is code to show how to terminate a thread: | |||
~~~~~~~{.c} | ~~~~~~~{.c} | |||
i = osip_thread_join (thread); | i = osip_thread_join (thread); | |||
osip_free (thread); | osip_free (thread); | |||
~~~~~~~ | ~~~~~~~ | |||
* @section howto_portability1 Mutex | * @section howto_portability3 Mutex | |||
+ Here is code to show how to create/lock/unlock/release: | + Here is code to show how to create/lock/unlock/release: | |||
~~~~~~~{.c} | ~~~~~~~{.c} | |||
struct osip_mutex *mutex; | struct osip_mutex *mutex; | |||
mutex = osip_mutex_init (); | mutex = osip_mutex_init (); | |||
osip_mutex_lock (mutex); | osip_mutex_lock (mutex); | |||
do_actions (); | do_actions (); | |||
osip_mutex_unlock (mutex); | osip_mutex_unlock (mutex); | |||
osip_mutex_destroy (mutex); | osip_mutex_destroy (mutex); | |||
~~~~~~~ | ~~~~~~~ | |||
* @section howto_portability1 Time | * @section howto_portability4 Time | |||
libosip2 is also providing a common time API. | libosip2 is also providing a common time API. | |||
This is usefull to implement in various way | This is usefull to implement in various way | |||
a CLOCK_MONOTONIC time and make time adjustement | a CLOCK_MONOTONIC time and make time adjustement | |||
when a drift is discovered against realtime | when a drift is discovered against realtime | |||
clock. | clock. | |||
**Note**: It is required to call osip_compensatetime | **Note**: It is required to call osip_compensatetime | |||
on Android which goes regularly into deep sleep mode. | on Android which goes regularly into deep sleep mode. | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added |