推荐 最新
加班使我熟睡

图中的Python协程代码一直报错应当如何解决,初学者求助,问题较多?

https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20240917/6a743c36ff7b202d474be324c52ae6a7.png https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20240917/055b565196c1d4c272f525396c3858c3.png 这个代码一直报错,感觉错误不少,我还看不懂是怎么一回事 有没有大佬解决一下,我将感激不尽,谢谢!!!

0
1
0
浏览量200
梦想缔造狮

为什么虚拟线程无法在虚拟线程池中执行?

环境: java21 问题: methods5不会输出log.info的内容, methods6正常打印log.info的内容 private static void methods5() { ThreadFactory tf = Thread.ofVirtual().factory(); try (ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor()) { Thread vt = tf.newThread(() -> log.info("vt task executed.")); for (int i = 0; i log.info("thread task executed.")); for (int i = 0; i < 5; i++) { try { executor.submit(thread).get(); } catch (InterruptedException | ExecutionException e) { // 处理异常 } } } }

0
1
0
浏览量18