Skip to content

Commit 00705b4

Browse files
[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.
1 parent 4e2f3b1 commit 00705b4

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

stdlib/public/BackDeployConcurrency/AsyncStream.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,27 @@
1212

1313
#include <new>
1414

15+
#include "swift/Runtime/Config.h"
1516
#include "swift/Threading/Mutex.h"
1617

1718
namespace swift {
1819
// return the size in words for the given mutex primitive
20+
SWIFT_CC(swift)
1921
extern "C"
2022
size_t _swift_async_stream_lock_size() {
2123
size_t words = sizeof(Mutex) / sizeof(void *);
2224
if (words < 1) { return 1; }
2325
return words;
2426
}
2527

28+
SWIFT_CC(swift)
2629
extern "C" void _swift_async_stream_lock_init(Mutex &lock) {
2730
new (&lock) Mutex();
2831
}
2932

33+
SWIFT_CC(swift)
3034
extern "C" void _swift_async_stream_lock_lock(Mutex &lock) { lock.lock(); }
3135

36+
SWIFT_CC(swift)
3237
extern "C" void _swift_async_stream_lock_unlock(Mutex &lock) { lock.unlock(); }
3338
}

stdlib/public/Concurrency/AsyncStream.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,27 @@
1212

1313
#include <new>
1414

15+
#include "swift/Runtime/Config.h"
1516
#include "swift/Threading/Mutex.h"
1617

1718
namespace swift {
1819
// return the size in words for the given mutex primitive
20+
SWIFT_CC(swift)
1921
extern "C"
2022
size_t _swift_async_stream_lock_size() {
2123
size_t words = sizeof(Mutex) / sizeof(void *);
2224
if (words < 1) { return 1; }
2325
return words;
2426
}
2527

28+
SWIFT_CC(swift)
2629
extern "C" void _swift_async_stream_lock_init(Mutex &lock) {
2730
new (&lock) Mutex();
2831
}
2932

33+
SWIFT_CC(swift)
3034
extern "C" void _swift_async_stream_lock_lock(Mutex &lock) { lock.lock(); }
3135

36+
SWIFT_CC(swift)
3237
extern "C" void _swift_async_stream_lock_unlock(Mutex &lock) { lock.unlock(); }
3338
}

0 commit comments

Comments
 (0)