Actor.cpp (swift-swift-5.8-RELEASE) | : | Actor.cpp (swift-swift-5.8.1-RELEASE) | ||
---|---|---|---|---|
#include "Runtime/Concurrency.h" | #include "Runtime/Concurrency.h" | |||
#include "Concurrency/Actor.h" | #include "Concurrency/Actor.h" | |||
#include "Concurrency/Task.h" | #include "Concurrency/Task.h" | |||
#include "Concurrency/TaskPrivate.h" | #include "Concurrency/TaskPrivate.h" | |||
#include "Concurrency/VoucherSupport.h" | #include "Concurrency/VoucherSupport.h" | |||
#include "swift/Runtime/Atomic.h" | #include "swift/Runtime/Atomic.h" | |||
#include "swift/Runtime/Casting.h" | #include "swift/Runtime/Casting.h" | |||
#include "Runtime/Threading/ThreadLocal.h" | #include "Runtime/Threading/ThreadLocal.h" | |||
#include <Availability.h> | ||||
#include <TargetConditionals.h> | ||||
#include <atomic> | #include <atomic> | |||
#include <new> | #include <new> | |||
using namespace swift; | using namespace swift; | |||
namespace { | namespace { | |||
/// An extremely silly class which exists to make pointer | /// An extremely silly class which exists to make pointer | |||
/// default-initialization constexpr. | /// default-initialization constexpr. | |||
template <class T> struct Pointer { | template <class T> struct Pointer { | |||
skipping to change at line 148 | skipping to change at line 151 | |||
return task; | return task; | |||
} | } | |||
void swift::adoptTaskVoucher(AsyncTask *task) { | void swift::adoptTaskVoucher(AsyncTask *task) { | |||
ExecutorTrackingInfo::current()->swapToJob(task); | ExecutorTrackingInfo::current()->swapToJob(task); | |||
} | } | |||
void swift::restoreTaskVoucher(AsyncTask *task) { | void swift::restoreTaskVoucher(AsyncTask *task) { | |||
ExecutorTrackingInfo::current()->restoreVoucher(task); | ExecutorTrackingInfo::current()->restoreVoucher(task); | |||
} | } | |||
static swift_once_t voucherDisableCheckOnce; | ||||
static bool vouchersDisabled; | ||||
namespace { | ||||
struct _SwiftNSOperatingSystemVersion{ | ||||
intptr_t majorVersion; | ||||
intptr_t minorVersion; | ||||
intptr_t patchVersion; | ||||
}; | ||||
} | ||||
extern "C" | ||||
_SwiftNSOperatingSystemVersion | ||||
_swift_stdlib_operatingSystemVersion() __attribute__((const)); | ||||
static void _initializeVouchersDisabled(void *ctxt) { | ||||
auto osVersion = _swift_stdlib_operatingSystemVersion(); | ||||
#if TARGET_OS_WATCH | ||||
vouchersDisabled = ( | ||||
osVersion.majorVersion == 8 && | ||||
osVersion.minorVersion >= 0 && osVersion.minorVersion < 3 | ||||
); | ||||
#elif TARGET_OS_IPHONE | ||||
vouchersDisabled = ( | ||||
osVersion.majorVersion == 15 && | ||||
osVersion.minorVersion >= 0 && osVersion.minorVersion < 2 | ||||
); | ||||
#elif TARGET_OS_OSX | ||||
vouchersDisabled = ( | ||||
osVersion.majorVersion == 12 && | ||||
osVersion.minorVersion >= 0 && osVersion.minorVersion < 1 | ||||
); | ||||
#else | ||||
vouchersDisabled = false; | ||||
#endif | ||||
} | ||||
bool VoucherManager::vouchersAreDisabled() { | ||||
swift_once(&voucherDisableCheckOnce, | ||||
&_initializeVouchersDisabled, | ||||
nullptr); | ||||
return vouchersDisabled; | ||||
} | ||||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added |