线程(英语:thread)是操作系统能够进行运算调度的最小单位。
进程(英语:process),是计算机中已运行程序的实体/进程是具有独立功能的程序在一个数据集合上运行的过程,它是系统进行资源分配和调度的一个独立单位。
进程:更好的描述和控制程序的并发执行,实现操作系统的并发性和共享性。 线程:减少程序在并发执行是所付出的时空开销,提高操作系统的并发性能。
| import { LiquidityPoolKeysV4, MARKET_STATE_LAYOUT_V3, Market, TOKEN_PROGRAM_ID } from "@raydium-io/raydium-sdk"; | |
| import { Connection, Logs, ParsedInnerInstruction, ParsedInstruction, ParsedTransactionWithMeta, PartiallyDecodedInstruction, PublicKey } from "@solana/web3.js"; | |
| const RPC_ENDPOINT = 'https://api.mainnet-beta.solana.com'; | |
| const RAYDIUM_POOL_V4_PROGRAM_ID = '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'; | |
| const SERUM_OPENBOOK_PROGRAM_ID = 'srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX'; | |
| const SOL_MINT = 'So11111111111111111111111111111111111111112'; | |
| const SOL_DECIMALS = 9; | |
| const connection = new Connection(RPC_ENDPOINT); |
| + (instancetype)imageWithLightImageBlock:(UIImage *(^)(void))lightImageBlock | |
| darkImageBlock:(UIImage *(^)(void))darkImageBlock | |
| { | |
| __block UIImage *image = nil; | |
| if (@available(iOS 13.0, *)) { | |
| UITraitCollection *const scaleTraitCollection = [UITraitCollection currentTraitCollection]; | |
| UITraitCollection *const lightUnscaledTraitCollection = [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleLight]; |
| - (UIViewController *)topViewController{ | |
| return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController]; | |
| } | |
| - (UIViewController *)topViewController:(UIViewController *)rootViewController | |
| { | |
| if (rootViewController.presentedViewController == nil) { | |
| return rootViewController; | |
| } | |
| -(float)compareString:(NSString *)originalString withString:(NSString *)comparisonString | |
| { | |
| // Normalize strings | |
| [originalString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; | |
| [comparisonString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; | |
| originalString = [originalString lowercaseString]; | |
| comparisonString = [comparisonString lowercaseString]; | |
| // Step 1 (Steps follow description at http://www.merriampark.com/ld.htm) |