上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 181 下一页
摘要: 一,代码: binding.button1.setOnClickListener { println("sleep1 start,") // 协程已在等待时主线程还在继续 Thread.sleep(200L) // 阻塞主线程 0.2 秒钟 println("sleep1 end,") // 协程已 阅读全文
posted @ 2025-07-19 07:47 刘宏缔的架构森林 阅读(65) 评论(0) 推荐(0)
摘要: 一,代码: binding.button1.setOnClickListener { //启动debug模式,可以打印协程的编号 System.setProperty("kotlinx.coroutines.debug", "on") println("runBlocking外运行: ${Threa 阅读全文
posted @ 2025-07-19 07:47 刘宏缔的架构森林 阅读(44) 评论(0) 推荐(0)
摘要: 一,用runBlocking创建协程 1,代码: binding.button1.setOnClickListener { System.setProperty("kotlinx.coroutines.debug", "on") val count = AtomicInteger() val for 阅读全文
posted @ 2025-07-19 07:47 刘宏缔的架构森林 阅读(15) 评论(0) 推荐(0)
摘要: 一,代码: //处理按钮点击事件,创建一个假数据,保存到viewmodel binding.button1.setOnClickListener { //只有一个函数类型作为函数参数 fun highOrderFunction(operation: (Int, Int) -> Int): Int { 阅读全文
posted @ 2025-07-19 07:46 刘宏缔的架构森林 阅读(36) 评论(0) 推荐(0)
摘要: 一,代码: binding.button1.setOnClickListener { //定义一个函数类型的变量,用来返回参数的平方 val square: (Int) -> Int = { it * it } // `it` 代表传入的参数 println("square(5)的结果:"+squa 阅读全文
posted @ 2025-07-19 07:46 刘宏缔的架构森林 阅读(38) 评论(0) 推荐(0)
摘要: 一,代码: // 1 . 声明函数类型,需放在顶层,不能在类和方法中 typealias mathAdd = (Int, Int) -> Int ... //处理按钮点击事件 binding.button1.setOnClickListener { // 2 . 为预定义函数类型实例化 var ad 阅读全文
posted @ 2025-07-19 07:46 刘宏缔的架构森林 阅读(19) 评论(0) 推荐(0)
摘要: 一,安装第三方库: 文档地址: https://www.workerman.net/doc/webman/components/crontab.html 从命令行安装: $ composer require workerman/crontab ./composer.json has been upd 阅读全文
posted @ 2025-07-19 07:46 刘宏缔的架构森林 阅读(85) 评论(0) 推荐(0)
摘要: 一,代码: binding.button2.setOnClickListener { println("点击代码块开始:") runBlocking { // 1 launch { val threadId = Thread.currentThread().id val threadName = T 阅读全文
posted @ 2025-07-19 07:44 刘宏缔的架构森林 阅读(18) 评论(0) 推荐(0)
摘要: 一,代码: //launch binding.button1.setOnClickListener { println("点击代码块开始:") GlobalScope.launch { // 1 println("Launch执行开始") // 2 delay(1000L) // 3 println 阅读全文
posted @ 2025-07-19 07:44 刘宏缔的架构森林 阅读(85) 评论(0) 推荐(0)
摘要: 一,下载安装包 官方地址: https://github.com/phpredis/phpredis/tags 因为要针对旧版本,我们使用以前下载的安装包 二,安装 解压 $ tar -zxvf redis-2.2.8.tgz 配置扩展库 cd redis-2.2.8 $ /data/softwar 阅读全文
posted @ 2025-07-19 07:43 刘宏缔的架构森林 阅读(23) 评论(0) 推荐(0)
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 181 下一页