Skip to content

Commit

Permalink
Fix Posix Build
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks committed Jun 19, 2021
1 parent a465924 commit bea6d5c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/inc/quic_platform_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ extern "C" {
// Interlocked implementations.
//

#define YieldProcessor() // no-op

This comment has been minimized.

Copy link
@ThadHouse

ThadHouse Jun 19, 2021

Contributor

pthread_yield


inline
long
InterlockedIncrement(
Expand All @@ -106,6 +108,26 @@ InterlockedDecrement(
return __sync_sub_and_fetch(Addend, (long)1);
}

inline
long
InterlockedAnd(
_Inout_ _Interlocked_operand_ long volatile *Destination,
_In_ long Value
)
{
return __sync_and_and_fetch(Destination, Value);
}

inline
long
InterlockedOr(
_Inout_ _Interlocked_operand_ long volatile *Destination,
_In_ long Value
)
{
return __sync_or_and_fetch(Destination, Value);
}

inline
int64_t
InterlockedExchangeAdd64(
Expand All @@ -127,6 +149,17 @@ InterlockedCompareExchange16(
return __sync_val_compare_and_swap(Destination, Comperand, ExChange);
}

inline
short
InterlockedCompareExchange(
_Inout_ _Interlocked_operand_ long volatile *Destination,
_In_ long ExChange,
_In_ long Comperand
)
{
return __sync_val_compare_and_swap(Destination, Comperand, ExChange);
}

inline
int64_t
InterlockedCompareExchange64(
Expand Down
19 changes: 19 additions & 0 deletions src/platform/inline.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ InterlockedDecrement(
_Inout_ _Interlocked_operand_ long volatile *Addend
);

long
InterlockedAnd(
_Inout_ _Interlocked_operand_ long volatile *Destination,
_In_ long Value
);

long
InterlockedOr(
_Inout_ _Interlocked_operand_ long volatile *Destination,
_In_ long Value
);

int64_t
InterlockedExchangeAdd64(
_Inout_ _Interlocked_operand_ int64_t volatile *Addend,
Expand All @@ -128,6 +140,13 @@ InterlockedCompareExchange16(
_In_ short Comperand
);

short
InterlockedCompareExchange(
_Inout_ _Interlocked_operand_ long volatile *Destination,
_In_ long ExChange,
_In_ long Comperand
);

int64_t
InterlockedCompareExchange64(
_Inout_ _Interlocked_operand_ int64_t volatile *Destination,
Expand Down

0 comments on commit bea6d5c

Please sign in to comment.