mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
ced4fc8947
Still need to: - Fix indentation - Check for any FutureSource being returned instead of FutureSource.future - Check for then: vs thenTry: mixups - Check for main thread related issues - Check for other exception catching issues - Adjust directory layout - Manual end-to-end testing
49 lines
1.4 KiB
Objective-C
49 lines
1.4 KiB
Objective-C
#import <Foundation/Foundation.h>
|
|
|
|
@interface RunningThreadRunLoopPair : NSObject
|
|
|
|
@property (nonatomic,readonly) NSThread* thread;
|
|
@property (nonatomic,readonly) NSRunLoop* runLoop;
|
|
|
|
+(RunningThreadRunLoopPair*) startNewWithThreadName:(NSString*)name;
|
|
-(void) terminate;
|
|
|
|
@end
|
|
|
|
/**
|
|
*
|
|
* The thread manager is responsible for starting and exposing the low/normal/high latency threads.
|
|
*
|
|
* Low latency:
|
|
* - Includes: Audio encoding/decoding, communicating audio data, advancing zrtp handshake, etc.
|
|
* - Operations on this thread should complete at human-interaction speeds (<30ms) and avoid swamping.
|
|
* - If an operation must be low latency but takes too long, split it into parts that can be interleaved.
|
|
*
|
|
* Normal latency:
|
|
* - Includes: Registration
|
|
* - Operations on this thread should complete at human-reaction speeds (<250ms).
|
|
*
|
|
* High latency:
|
|
* - Includes: DNS CNAME lookup (due to gethostbyname blocking and being non-reentrant and non-threadsafe)
|
|
* - Operations on this thread should complete at human-patience speeds (<10s).
|
|
*
|
|
*/
|
|
|
|
@interface ThreadManager : NSObject{
|
|
@private RunningThreadRunLoopPair* low;
|
|
@private RunningThreadRunLoopPair* normal;
|
|
@private RunningThreadRunLoopPair* high;
|
|
}
|
|
|
|
+(NSThread*)lowLatencyThread;
|
|
+(NSRunLoop*)lowLatencyThreadRunLoop;
|
|
|
|
+(NSThread*)normalLatencyThread;
|
|
+(NSRunLoop*)normalLatencyThreadRunLoop;
|
|
|
|
+(NSThread*)highLatencyThread;
|
|
+(NSRunLoop*)highLatencyThreadRunLoop;
|
|
|
|
+(void) terminate;
|
|
|
|
@end
|