pEpObjCAdapter/PEPCopyableThread.h
author Dirk Zimmermann <dz@pep.security>
Thu, 12 Sep 2019 16:41:52 +0200
branchIOSAD-141
changeset 1245 cd15ff3a40b9
parent 262 9ab6513df261
permissions -rw-r--r--
IOSAD-141 Don't share session between threads.
andreas@260
     1
//
andreas@260
     2
//  PEPCopyableThread.h
andreas@260
     3
//  pEpObjCAdapter
andreas@260
     4
//
andreas@260
     5
//  Created by Andreas Buff on 06.10.17.
andreas@260
     6
//  Copyright © 2017 p≡p. All rights reserved.
andreas@260
     7
//
andreas@260
     8
andreas@260
     9
#import <Foundation/Foundation.h>
andreas@260
    10
andreas@262
    11
@class PEPCopyableThread;
andreas@262
    12
andreas@260
    13
/**
andreas@260
    14
 Wrapper around NSThread. Created solely to be able to use a thread as key in
andreas@260
    15
 a NSDIctionary (e.g. conform to NSCopying).
andreas@260
    16
 */
andreas@260
    17
@interface PEPCopyableThread : NSObject<NSCopying>
andreas@260
    18
andreas@262
    19
@property (atomic, strong, readonly) NSThread * _Nullable thread;
andreas@260
    20
andreas@262
    21
- (instancetype _Nonnull )initWithThread:(NSThread * _Nonnull)thread;
andreas@262
    22
andreas@262
    23
/**
andreas@262
    24
 A Boolean value that indicates whether the receiver has finished execution.
andreas@262
    25
 @return YES if the receiver has finished execution, otherwise NO.
andreas@262
    26
 */
andreas@262
    27
- (BOOL)isFinished;
andreas@262
    28
andreas@262
    29
/**
andreas@262
    30
 Changes the cancelled state of the receiver to indicate that it should exit.
andreas@262
    31
 */
andreas@262
    32
- (void)cancel;
andreas@260
    33
andreas@260
    34
@end