Cross platform synchronization primatives and high precision timestamps
1 Download
2 Build
3 Example
3.1 Example output
4.1 Type definitions
To download sync, execute the following command
$ git clone https://github.com/Jacob-C-Smith/sync
To build on UNIX like machines, execute the following commands in the same directory
$ cd sync
$ cmake .
$ make
This will build the example program, the tester program, and dynamic / shared libraries
To build sync for Windows machines, open the base directory in Visual Studio, and build your desired target(s)
To run the example program, execute this command
$ ./sync_example
[ NONE ]
typedef ... mutex;
typedef ... semaphore;
typedef size_t timestamp;
NOTE: mutex and semaphore definitions are platform dependent
// Subsystem initialization
void sync_init ( void );
// Timestamps
timestamp timer_high_precision ( void );
size_t timer_seconds_divisor ( void );
// Constructors
int mutex_create ( mutex *p_mutex );
int semaphore_create ( semaphore *p_semaphore, int count );
// Lock operations
int mutex_lock ( mutex _mutex );
int semaphore_wait ( semaphore _semaphore );
// Unlock operations
int mutex_unlock ( mutex _mutex );
int semaphore_signal ( semaphore _semaphore );
// Destructors
int mutex_destroy ( mutex *p_mutex );
int semaphore_destroy ( semaphore *p_semaphore );
Written by Jacob Smith, 2023