xhawk18

Results 47 comments of xhawk18

抓到异常是对的,因为resolve/reject需要下一级的 then/fail 函数捕获。 如果参数类型不一样,无法捕获,就抛异常了。可以这样试下 ``` .then([&next](){ output_func_name(); next = newPromise([](Defer d) { output_func_name(); }); next.resolve(1, 'c'); return next; }).then([](int a, char b) { printf("a = %d, b = %d\n", a,...

线程切换回来再调用,应该问题不大。 因为: 1. 任务链实例析构时,代码会根据需要做出判断,是否要调用 ”全局异常handler“。只要保证任务链实例还在,就不会走到全局异常。 2. next或d内部,都通过shared_ptr的方式,保存了任务链实例。 3. 线程切换回来调用,必定要保障 next或d至少有一个(或其复制品)还能访问到。(对比一楼的状况,next和d都被析构了,内部的任务链也析构了,于是走到全局异常。)

> yes believe yourself, it is right also believe yan & yuan can help me ...

Thank you @Sylvain303 ! It may be a feature request 😉

https://github.com/xhawk18/s_task hardware: x86, x64, arm, aarch64, mips, mips64, cortex-m0/m3/m4, stm8 os: windows, linux, macos, android, mingw, and even no OS network: libuv other: support await / async

一个很好的问题,如果你使用 [s_task](https://github.com/xhawk18/s_task), 有个函数 s_task_cancel_wait,可以让处于等待状态的协程立刻结束等待。这样在等待中的函数会退出,并返回错误代码,协程代码就可以进行后续处理了。 这个方式只是退出等待函数,很安全,比暴力杀死协程好,不会造成资源泄露。 另外关于等待函数,s_task还加入了两个参数 **\_\_await\_\_**,**\_\_async\_\_**,标记哪些函数是要等待的。如此,多任务编程时,程序员很明确的知道,在何时cpu会被切换,在何时cpu不会被切换。这样使用共享变量更容易和安全。 我几乎看了所有的C协程库,都没引入有传染性的 await/async 机制,不知道各位用的放不放心?

可以使用这个: https://github.com/xhawk18/s_task cpu架构: x86, x64, arm, aarch64, mips, mips64, cortex-m0/m3/m4, stm8 系统环境: windows, linux, macos, android, mingw, 甚至可以无OS裸奔(嵌入式环境下) 网络库: libuv 其他: 支持 await / async

![cmake](https://github.com/microsoft/vscode-cmake-tools/assets/4671118/2a721d95-2f19-4c4e-8c87-c601672d9810) [cmake_test.zip](https://github.com/microsoft/vscode-cmake-tools/files/14078732/cmake_test.zip) The project "my_proj" has two building folders configured by cmake-gui, "build_msvc" configured under windows for msvc, and "build_wsl_gcc" configured under wsl for gcc. "open the source folder by...

> As for the VS Code CMake Tools extension itself, you can do this currently by opening VS Code in the root folder, and then pointing the cmake.buildDirectory setting to...

cmake目录您可自行设定,不影响。