Skip to content

Commit

Permalink
-try to fix hpcom test using spinlocks for osx
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18302 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Volker Waurich committed Nov 26, 2013
1 parent 3a34bec commit d0e5caa
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Compiler/Template/CodegenC.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2193,7 +2193,11 @@ template function_HPCOM_initializeLock(String lockIdx, String lockPrefix, String
>>
case ("pthreads_spin") then
<<
#ifdef __APPLE__
<%lockPrefix%>_<%lockIdx%> = OS_SPINLOCK_INIT;
#else
pthread_spin_init(&<%lockPrefix%>_<%lockIdx%>, 0);
#endif
>>
end function_HPCOM_initializeLock;
Expand All @@ -2210,7 +2214,11 @@ template function_HPCOM_createLock(String lockIdx, String prefix, String iType)
>>
case ("pthreads_spin") then
<<
#ifdef __APPLE__
static OSSpinLock <%prefix%>_<%lockIdx%>;
#else
static pthread_spinlock_t <%prefix%>_<%lockIdx%>;
#endif
>>
end function_HPCOM_createLock;
Expand All @@ -2227,7 +2235,11 @@ template function_HPCOM_assignLock(String lockIdx, String prefix, String iType)
>>
case ("pthreads_spin") then
<<
#ifdef __APPLE__
OSSpinLockLock(&<%prefix%>_<%lockIdx%>);
#else
pthread_spin_lock(&<%prefix%>_<%lockIdx%>);
#endif
>>
end function_HPCOM_assignLock;
Expand All @@ -2244,7 +2256,11 @@ template function_HPCOM_releaseLock(String lockIdx, String prefix, String iType)
>>
case ("pthreads_spin") then
<<
#ifdef __APPLE__
OSSpinLockUnlock(&<%prefix%>_<%lockIdx%>);
#else
pthread_spin_unlock(&<%prefix%>_<%lockIdx%>);
#endif
>>
end function_HPCOM_releaseLock;
Expand Down

0 comments on commit d0e5caa

Please sign in to comment.