diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 0d5dd82690..1e38484293 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -2650,7 +2650,7 @@ D9683D922D485BD300F423F4 /* chat_item_direct_story_reply_with_edits_09.binproto in Resources */ = {isa = PBXBuildFile; fileRef = D9683D6F2D485BD300F423F4 /* chat_item_direct_story_reply_with_edits_09.binproto */; }; D9683D932D485BD300F423F4 /* chat_item_direct_story_reply_with_edits_04.binproto in Resources */ = {isa = PBXBuildFile; fileRef = D9683D652D485BD300F423F4 /* chat_item_direct_story_reply_with_edits_04.binproto */; }; D9683D942D485BD300F423F4 /* chat_item_direct_story_reply_with_edits_07.txtproto in Resources */ = {isa = PBXBuildFile; fileRef = D9683D6C2D485BD300F423F4 /* chat_item_direct_story_reply_with_edits_07.txtproto */; }; - D96869452E1065F5005451E4 /* AsyncAtomic.swift in Sources */ = {isa = PBXBuildFile; fileRef = D96869442E1065F1005451E4 /* AsyncAtomic.swift */; }; + D96869452E1065F5005451E4 /* SeriallyAccessedState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D96869442E1065F1005451E4 /* SeriallyAccessedState.swift */; }; D968B4982C9E1AD1006B14E1 /* SmsLockIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D968B4972C9E1AC3006B14E1 /* SmsLockIconView.swift */; }; D968F71E2C34884B00AB318B /* BackupArchiveReleaseNotesRecipientArchiver.swift in Sources */ = {isa = PBXBuildFile; fileRef = D968F71D2C34884B00AB318B /* BackupArchiveReleaseNotesRecipientArchiver.swift */; }; D96A94A72954E57F004EA434 /* DonateViewController+MonthlyPaypalDonation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D96A94A62954E57F004EA434 /* DonateViewController+MonthlyPaypalDonation.swift */; }; @@ -6611,7 +6611,7 @@ D9683D702D485BD300F423F4 /* chat_item_direct_story_reply_with_edits_09.txtproto */ = {isa = PBXFileReference; lastKnownFileType = text; path = chat_item_direct_story_reply_with_edits_09.txtproto; sourceTree = ""; }; D9683D712D485BD300F423F4 /* chat_item_direct_story_reply_with_edits_10.binproto */ = {isa = PBXFileReference; lastKnownFileType = file; path = chat_item_direct_story_reply_with_edits_10.binproto; sourceTree = ""; }; D9683D722D485BD300F423F4 /* chat_item_direct_story_reply_with_edits_10.txtproto */ = {isa = PBXFileReference; lastKnownFileType = text; path = chat_item_direct_story_reply_with_edits_10.txtproto; sourceTree = ""; }; - D96869442E1065F1005451E4 /* AsyncAtomic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsyncAtomic.swift; sourceTree = ""; }; + D96869442E1065F1005451E4 /* SeriallyAccessedState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeriallyAccessedState.swift; sourceTree = ""; }; D968B4972C9E1AC3006B14E1 /* SmsLockIconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmsLockIconView.swift; sourceTree = ""; }; D968F71D2C34884B00AB318B /* BackupArchiveReleaseNotesRecipientArchiver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackupArchiveReleaseNotesRecipientArchiver.swift; sourceTree = ""; }; D96A94A62954E57F004EA434 /* DonateViewController+MonthlyPaypalDonation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DonateViewController+MonthlyPaypalDonation.swift"; sourceTree = ""; }; @@ -8901,7 +8901,6 @@ 500AF3A92C58346500CB9F4F /* Concurrency */ = { isa = PBXGroup; children = ( - D96869442E1065F1005451E4 /* AsyncAtomic.swift */, 500AF3AA2C58347C00CB9F4F /* CancellableContinuation.swift */, 500AF3AC2C5834A400CB9F4F /* CancellableContinuationTest.swift */, 50C0203B2CA4A61E00BDC4EF /* ConcurrentTaskQueue.swift */, @@ -8911,6 +8910,7 @@ D912209D2DDD94E1008BCC4B /* DebouncedTaskTest.swift */, 50B0BCA22DFA17BE0076B680 /* Monitor.swift */, 50C0203D2CA4A7A500BDC4EF /* Retry.swift */, + D96869442E1065F1005451E4 /* SeriallyAccessedState.swift */, 6605B9852B2112A100E8A68A /* SerialTaskQueue.swift */, 726C94212D6F442200ABF9B9 /* UncooperativeTimeout.swift */, 726C94232D6F481B00ABF9B9 /* UncooperativeTimeoutTest.swift */, @@ -17605,7 +17605,6 @@ C1DAA7582C13C1E00078AE84 /* ArchivedPayment.swift in Sources */, C1DAA75A2C1742680078AE84 /* ArchivedPaymentStore.swift in Sources */, F9C5CE0A289453B400548EEE /* Array+SSK.swift in Sources */, - D96869452E1065F5005451E4 /* AsyncAtomic.swift in Sources */, F9C5CDF7289453B400548EEE /* Atomics.swift in Sources */, 6640132C2BFFB8F500F10FC4 /* Attachment+ConstructionParams.swift in Sources */, 66D7B91D2B97C5330005C98B /* Attachment+ContentType.swift in Sources */, @@ -18487,6 +18486,7 @@ 6619A1BD2B2A8148004B38FE /* SentMessageTranscriptReceiverImpl.swift in Sources */, 6619A1BF2B2A8238004B38FE /* SentMessageTranscriptReceiverMock.swift in Sources */, F9C5CE4C289453B400548EEE /* Sequence+OWS.swift in Sources */, + D96869452E1065F5005451E4 /* SeriallyAccessedState.swift in Sources */, 6605B9862B2112A100E8A68A /* SerialTaskQueue.swift in Sources */, 50A5AA9B2A7449D000CF2ECC /* ServerReceiptEnvelope.swift in Sources */, 507CD5E529660D5100E47DAC /* ServiceId.swift in Sources */, diff --git a/Signal/Backups/BackupSettingsAttachmentDownloadTracker.swift b/Signal/Backups/BackupSettingsAttachmentDownloadTracker.swift index 961801412a..9d2797260c 100644 --- a/Signal/Backups/BackupSettingsAttachmentDownloadTracker.swift +++ b/Signal/Backups/BackupSettingsAttachmentDownloadTracker.swift @@ -94,7 +94,7 @@ private class Tracker { private let backupAttachmentDownloadQueueStatusReporter: BackupAttachmentDownloadQueueStatusReporter private let backupAttachmentDownloadProgress: BackupAttachmentDownloadProgress - private let state: AsyncAtomic + private let state: SeriallyAccessedState init( backupAttachmentDownloadQueueStatusReporter: BackupAttachmentDownloadQueueStatusReporter, @@ -103,7 +103,7 @@ private class Tracker { ) { self.backupAttachmentDownloadQueueStatusReporter = backupAttachmentDownloadQueueStatusReporter self.backupAttachmentDownloadProgress = backupAttachmentDownloadProgress - self.state = AsyncAtomic(State(streamContinuation: continuation)) + self.state = SeriallyAccessedState(State(streamContinuation: continuation)) } func start() { diff --git a/Signal/Backups/BackupSettingsAttachmentUploadTracker.swift b/Signal/Backups/BackupSettingsAttachmentUploadTracker.swift index a48130cbd4..fb67d03355 100644 --- a/Signal/Backups/BackupSettingsAttachmentUploadTracker.swift +++ b/Signal/Backups/BackupSettingsAttachmentUploadTracker.swift @@ -92,7 +92,7 @@ private class Tracker { private let backupAttachmentUploadQueueStatusReporter: BackupAttachmentUploadQueueStatusReporter private let backupAttachmentUploadProgress: BackupAttachmentUploadProgress - private let state: AsyncAtomic + private let state: SeriallyAccessedState init( backupAttachmentUploadQueueStatusReporter: BackupAttachmentUploadQueueStatusReporter, @@ -101,7 +101,7 @@ private class Tracker { ) { self.backupAttachmentUploadQueueStatusReporter = backupAttachmentUploadQueueStatusReporter self.backupAttachmentUploadProgress = backupAttachmentUploadProgress - self.state = AsyncAtomic(State( + self.state = SeriallyAccessedState(State( streamContinuation: continuation )) } diff --git a/SignalServiceKit/Backups/BackupExportJob/BackupExportJobRunner.swift b/SignalServiceKit/Backups/BackupExportJob/BackupExportJobRunner.swift index 2b452d77b4..974cc234f7 100644 --- a/SignalServiceKit/Backups/BackupExportJob/BackupExportJobRunner.swift +++ b/SignalServiceKit/Backups/BackupExportJob/BackupExportJobRunner.swift @@ -52,11 +52,11 @@ class BackupExportJobRunnerImpl: BackupExportJobRunner { } private let backupExportJob: BackupExportJob - private let state: AsyncAtomic + private let state: SeriallyAccessedState init(backupExportJob: BackupExportJob) { self.backupExportJob = backupExportJob - self.state = AsyncAtomic(State()) + self.state = SeriallyAccessedState(State()) } // MARK: - diff --git a/SignalServiceKit/Concurrency/AsyncAtomic.swift b/SignalServiceKit/Concurrency/SeriallyAccessedState.swift similarity index 96% rename from SignalServiceKit/Concurrency/AsyncAtomic.swift rename to SignalServiceKit/Concurrency/SeriallyAccessedState.swift index bf66107777..5f902e5c09 100644 --- a/SignalServiceKit/Concurrency/AsyncAtomic.swift +++ b/SignalServiceKit/Concurrency/SeriallyAccessedState.swift @@ -6,7 +6,7 @@ /// A wrapper around arbitrary state that asynchronously serializes access to /// that state, allowing callers to perform async work while maintaining /// exclusive access. -public class AsyncAtomic { +public class SeriallyAccessedState { private var state: State private let updatesQueue: SerialTaskQueue