IOSAD-103 retrieve_next_sync_event with assumptions

IOSAD-103
Dirk Zimmermann 4 years ago
parent 12de703032
commit 3530ee5e55
  1. 19
      pEpObjCAdapter/PEPSync.m

@ -26,6 +26,7 @@
@property (nonatomic, nullable) NSThread *syncThread;
- (int)injectSyncEvent:(SYNC_EVENT)event;
- (SYNC_EVENT)retrieveNextSyncEvent:(time_t)threshold;
@end
@ -57,6 +58,12 @@ static int inject_sync_eventObjc(SYNC_EVENT ev, void *management)
}
}
static SYNC_EVENT retrieve_next_sync_event(void *management, time_t threshold)
{
PEPSync *sync = (PEPSync *) CFBridgingRelease(management);
return [sync retrieveNextSyncEvent:threshold];
}
// MARK: - Internal globals
static __weak PEPSync *s_pEpSync;
@ -117,4 +124,16 @@ static __weak PEPSync *s_pEpSync;
return 0;
}
- (SYNC_EVENT)retrieveNextSyncEvent:(time_t)threshold
{
NSValue *value = [self.queue timedDequeue:&threshold];
if (value) {
SYNC_EVENT event;
[value getValue:&event];
return event;
} else {
return new_sync_timeout_event();
}
}
@end

Loading…
Cancel
Save