IOSAD-103 sync thread loop IOSAD-103
authorDirk Zimmermann <dirk@pep-project.org>
Tue, 30 Oct 2018 14:50:53 +0100
branchIOSAD-103
changeset 7201134b54a7082
parent 719 c722408a637f
child 721 0da7ffe1e9e2
IOSAD-103 sync thread loop
pEpObjCAdapter/PEPSync.h
pEpObjCAdapter/PEPSync.m
     1.1 --- a/pEpObjCAdapter/PEPSync.h	Tue Oct 30 14:50:53 2018 +0100
     1.2 +++ b/pEpObjCAdapter/PEPSync.h	Tue Oct 30 14:50:53 2018 +0100
     1.3 @@ -28,6 +28,9 @@
     1.4                                                   _Nonnull)syncSendMessageDelegate
     1.5                          notifyHandshakeDelegate:(id<PEPNotifyHandshakeDelegate>
     1.6                                                   _Nonnull)notifyHandshakeDelegate;
     1.7 +
     1.8 +- (void)startup;
     1.9 +
    1.10  - (void)shutdown;
    1.11  
    1.12  @end
     2.1 --- a/pEpObjCAdapter/PEPSync.m	Tue Oct 30 14:50:53 2018 +0100
     2.2 +++ b/pEpObjCAdapter/PEPSync.m	Tue Oct 30 14:50:53 2018 +0100
     2.3 @@ -23,6 +23,7 @@
     2.4  @property (nonatomic, nullable, weak) id<PEPSyncSendMessageDelegate> syncSendMessageDelegate;
     2.5  @property (nonatomic, nullable, weak) id<PEPNotifyHandshakeDelegate> notifyHandshakeDelegate;
     2.6  @property (nonatomic, nonnull) PEPQueue *queue;
     2.7 +@property (nonatomic, nullable) NSThread *syncThread;
     2.8  
     2.9  - (int)injectSyncEvent:(SYNC_EVENT)event;
    2.10  
    2.11 @@ -60,7 +61,7 @@
    2.12  
    2.13  static __weak PEPSync *s_pEpSync;
    2.14  
    2.15 -// MARK: - PEPSync class
    2.16 +// MARK: - Public PEPSync class
    2.17  
    2.18  @implementation PEPSync
    2.19  
    2.20 @@ -83,10 +84,24 @@
    2.21      return self;
    2.22  }
    2.23  
    2.24 +- (void)startup
    2.25 +{
    2.26 +    NSThread *theSyncThread = [[NSThread alloc] initWithTarget:self
    2.27 +                                                      selector:@selector(syncThreadLoop:)
    2.28 +                                                        object:nil];
    2.29 +    self.syncThread = theSyncThread;
    2.30 +}
    2.31 +
    2.32  - (void)shutdown
    2.33  {
    2.34  }
    2.35  
    2.36 +// MARK: - Private
    2.37 +
    2.38 +- (void)syncThreadLoop:(id)object {
    2.39 +
    2.40 +}
    2.41 +
    2.42  - (int)injectSyncEvent:(SYNC_EVENT)event
    2.43  {
    2.44      [self.queue enqueue:[NSValue valueWithBytes:&event objCType:@encode(SYNC_EVENT)]];