foreignCall conv_string results_code expr_code args_code vols safety ret
= do convention <- case conv_string of
"C" -> return CCallConv
+ "stdcall" -> return StdCallConv
"C--" -> return CmmCallConv
_ -> fail ("unknown calling convention: " ++ conv_string)
return $ do
#if CMINUSMINUS
-#define ACQUIRE_LOCK(mutex) pthread_mutex_lock(mutex)
-#define RELEASE_LOCK(mutex) pthread_mutex_unlock(mutex)
+#define ACQUIRE_LOCK(mutex) foreign "C" pthread_mutex_lock(mutex)
+#define RELEASE_LOCK(mutex) foreign "C" pthread_mutex_unlock(mutex)
#define ASSERT_LOCK_HELD(mutex) /* nothing */
#else
/* We jump through a hoop here to get a CCall EnterCriticalSection
and LeaveCriticalSection, as that's what C-- wants. */
-#define ACQUIRE_LOCK(mutex) CCallEnterCriticalSection(mutex)
-#define RELEASE_LOCK(mutex) CCallLeaveCriticalSection(mutex)
+#define ACQUIRE_LOCK(mutex) foreign "stdcall" EnterCriticalSection(mutex)
+#define RELEASE_LOCK(mutex) foreign "stdcall" LeaveCriticalSection(mutex)
#define ASSERT_LOCK_HELD(mutex) /* nothing */
#else
// The last thing we do is release sched_lock, which is
// preventing other threads from accessing blackhole_queue and
// picking up this thread before we are finished with it.
- foreign "C" RELEASE_LOCK(sched_mutex "ptr");
+ RELEASE_LOCK(sched_mutex "ptr");
#endif
jump StgReturn;
}
HP_CHK_GEN_TICKY(SIZE, R1_PTR & R2_PTR, atomicModifyMutVarzh_fast);
#if defined(THREADED_RTS)
- foreign "C" ACQUIRE_LOCK(atomic_modify_mutvar_mutex "ptr") [R1,R2];
+ ACQUIRE_LOCK(atomic_modify_mutvar_mutex "ptr") [R1,R2];
#endif
x = StgMutVar_var(R1);
StgThunk_payload(r,0) = z;
#if defined(THREADED_RTS)
- foreign "C" RELEASE_LOCK(atomic_modify_mutvar_mutex "ptr") [];
+ RELEASE_LOCK(atomic_modify_mutvar_mutex "ptr") [];
#endif
RET_P(r);
LDV_ENTER(R1);
#if defined(THREADED_RTS)
- foreign "C" ACQUIRE_LOCK(sched_mutex "ptr");
+ ACQUIRE_LOCK(sched_mutex "ptr");
// released in stg_block_blackhole_finally
#endif
#endif
#if defined(THREADED_RTS)
- foreign "C" ACQUIRE_LOCK(sched_mutex "ptr");
+ ACQUIRE_LOCK(sched_mutex "ptr");
// released in stg_block_blackhole_finally
#endif
(unsigned*)&pId) == 0);
}
-void CCallEnterCriticalSection(LPCRITICAL_SECTION s) {
- EnterCriticalSection(s);
-}
-
-void CCallLeaveCriticalSection(LPCRITICAL_SECTION s) {
- LeaveCriticalSection(s);
-}
-
#else /* !defined(THREADED_RTS) */
int