[Concurrency] Fix calling convention mismatch in AsyncStream

Functions defined in AsyncStream.cpp are called from Swift with swiftcc
but are defined with the C calling convention.
This commit is contained in:
Yuta Saito
2023-06-11 12:12:52 +00:00
parent 4e2f3b1c8c
commit 00705b4b2a
2 changed files with 10 additions and 0 deletions

View File

@@ -12,10 +12,12 @@
#include <new>
#include "swift/Runtime/Config.h"
#include "swift/Threading/Mutex.h"
namespace swift {
// return the size in words for the given mutex primitive
SWIFT_CC(swift)
extern "C"
size_t _swift_async_stream_lock_size() {
size_t words = sizeof(Mutex) / sizeof(void *);
@@ -23,11 +25,14 @@ size_t _swift_async_stream_lock_size() {
return words;
}
SWIFT_CC(swift)
extern "C" void _swift_async_stream_lock_init(Mutex &lock) {
new (&lock) Mutex();
}
SWIFT_CC(swift)
extern "C" void _swift_async_stream_lock_lock(Mutex &lock) { lock.lock(); }
SWIFT_CC(swift)
extern "C" void _swift_async_stream_lock_unlock(Mutex &lock) { lock.unlock(); }
}