Skip to content

Commit

Permalink
Update to 2.0.4 (#176)
Browse files Browse the repository at this point in the history
Special case ARM32 targets
  • Loading branch information
AaronRobinsonMSFT committed Aug 11, 2023
1 parent 15559ff commit 8d8bd26
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/dnne-pkg/dnne-pkg.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<PropertyGroup>
<PackageId>DNNE</PackageId>
<Version>2.0.3</Version>
<Version>2.0.4</Version>
<Authors>AaronRobinsonMSFT</Authors>
<Owners>AaronRobinsonMSFT</Owners>
<Description>Package used to generated native exports for .NET assemblies.</Description>
Expand Down
9 changes: 9 additions & 0 deletions src/platform/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,21 @@ static void set_current_error(int err)

static void enter_lock(dnne_lock_handle* lock)
{
#ifdef __arm__
// There are some arm32 platforms that don't provide __atomic_compare_exchange_n().
// Instead of trying to special case them, always use the compiler (gcc/clang) intrinsic.
while (__sync_val_compare_and_swap(lock, DNNE_LOCK_OPEN, -1) != DNNE_LOCK_OPEN)
{
(void)sched_yield(); // Yield instead of sleeping.
}
#else
long tmp = DNNE_LOCK_OPEN;
while (!__atomic_compare_exchange_n(lock, &tmp, -1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
{
(void)sched_yield(); // Yield instead of sleeping.
tmp = DNNE_LOCK_OPEN;
}
#endif // !__arm__
}

static void exit_lock(dnne_lock_handle* lock)
Expand Down

0 comments on commit 8d8bd26

Please sign in to comment.