Skip to content

Cross platform synchronization primitives and high-precision timing

License

Notifications You must be signed in to change notification settings

Jacob-C-Smith/sync

Repository files navigation

sync

sync

Cross platform synchronization primatives and high precision timestamps

1 Download

2 Build

3 Example

3.1 Example output

4 Definitions

4.1 Type definitions

4.2 Function definitions

Download

To download sync, execute the following command

$ git clone https://github.com/Jacob-C-Smith/sync

Build

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)

Example

To run the example program, execute this command

$ ./sync_example

Example output

[ NONE ]

Source

Definitions

Type definitions

typedef ...    mutex;
typedef ...    semaphore;
typedef size_t timestamp;

NOTE: mutex and semaphore definitions are platform dependent

Function definitions

// 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

About

Cross platform synchronization primitives and high-precision timing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published