草庐IT

task-modal

全部标签

c++ - packaged_task 卡在 operator() 上

在Ubuntu上使用gcc4.7.2编译,使用-std=c++11-O0-pthread编译,我以某种方式在代码中创建了一个死锁,它似乎不应该遇到这个问题。我有一个线程,它刚刚获得一个锁,然后运行​​vector>,调用一切。同时,主线程推送std::packaged_tasks一个接一个地处理它,并在该任务的future时阻止返回。任务本身是微不足道的(打印和返回)。这是完整的代码。运行应用程序有时会成功,但尝试几次就会挂起:#include#include#include#include#includestd::unique_locklock(){staticstd::mutexm

c++ - std::packaged_task 没有违反销毁 promise ?

我在使用打包任务时遇到了一些非常奇怪的事情。阅读时~packaged_task我的印象是,如果std::packaged_task在执行之前被销毁,则promise将被破坏,并且尝试从future获取结果应该抛出std::future_error。但是,在VisualStudio2013上,情况似乎并非如此。获取以下代码:#include#include#includeintmain(){std::futuref;{std::packaged_tasktask([](){return3;});f=task.get_future();}std::cout我希望在f.get()上获得一个s

node.js - 使用 npm 链接时如何修复 "Task is not in your gulpfile"错误?

我们有一堆共享通用gulp逻辑的应用程序,所以我们制作了一个gulp插件,其中包含一堆自定义任务。但是,我们希望避免为我们开发的每个应用程序安装gulp+我们的插件(以及一半的互联网)。理想情况下,我想这样做:npminstall-ggulpnpminstall-g那么对于每个应用,我们只需要做:npmlinkgulpnpmlink虽然这可行,但问题是gulp不再识别我们的任何自定义gulp任务。我运行的任何gulp命令都会导致:[15:16:51]Usinggulpfile/workspace/my-app/gulpfile.js[15:16:51]Task'dev'isnotiny

angularjs - 警告 : Running "compass:server" (compass) task

D:\Projects\mallspk>gruntserveRunning"serve"taskRunning"clean:server"(clean)task>>0pathscleaned.Running"wiredep:app"(wiredep)taskRunning"wiredep:test"(wiredep)taskRunning"wiredep:sass"(wiredep)taskRunning"concurrent:server"(concurrent)taskWarning:Running"compass:server"(compass)taskWarning:Comma

asp.net - 使用 HttpClient 进行测试时,Task.Run 永远不会完成

今天我在使用异步ApiControllers创建WebAPI时遇到了问题。我使用的是MongoDB,由于C#驱动程序不支持异步,所以我尝试在我的存储库层中实现它。Building存储库中生成的方法如下所示:publicasyncTask>GetAll(){vartcs=newTaskCompletetionSource>();awaitTask.Run(()=>{varc=this.MongoDbCollection.FindAll();tcs.SetResult(c);});returnawaittcs.Task;}现在,当使用NUnit自行测试存储库时,这可以完美运行。但是当从Co

asp.net - 使用 HttpClient 进行测试时,Task.Run 永远不会完成

今天我在使用异步ApiControllers创建WebAPI时遇到了问题。我使用的是MongoDB,由于C#驱动程序不支持异步,所以我尝试在我的存储库层中实现它。Building存储库中生成的方法如下所示:publicasyncTask>GetAll(){vartcs=newTaskCompletetionSource>();awaitTask.Run(()=>{varc=this.MongoDbCollection.FindAll();tcs.SetResult(c);});returnawaittcs.Task;}现在,当使用NUnit自行测试存储库时,这可以完美运行。但是当从Co

node.js - 咕噜声错误 : cannot find module 'load-grunt-tasks'

当我使用grunt命令时,它显示以下错误:$gruntLoading"Gruntfile.js"tasks...ERROR>>Error:Cannotfindmodule'load-grunt-tasks'Warning:Task"default"notfound.Use--forcetocontinue.Abortedduetowarnings.ExecutionTime(2015-02-0718:05:42UTC)loadingtasks339ms███████████████████████████████████████████████99%Total344ms我已经尝试过-n

javascript - AWS Lambda 错误 : "Cannot find module '/var/task/index'"

Node.jsAlexa任务问题我目前正在通过AWSLambda编写Node.jsAlexa任务,并且一直在尝试编写一个函数,该函数从OpenWeatherAPI接收信息并将其解析为名为weather的变量。相关代码如下:varrequest=require('request');varweather="";functionisBadWeather(location){varendpoint="http://api.openweathermap.org/data/2.5/weather?q="+location+"&APPID=205283d9c9211b776d3580d5de5d6

python - 取消任务后请解释 "Task was destroyed but it is pending!"

我正在使用Python3.4.2学习asyncio,并使用它在IPC总线上持续监听,而gbulb在DBus上监听。我创建了一个函数listen_to_ipc_channel_layer,它持续监听IPCchannel上的传入消息并将消息传递给message_handler。我也在听SIGTERM和SIGINT。当我向运行您在底部找到的代码的python进程发送SIGTERM时,脚本应该正常终止。我遇到的问题是以下警告:gotsignal15:exitTaskwasdestroyedbutitispending!task:wait_for=>Processfinishedwithexit

python - 属性错误 : Assignment not allowed to composite field "task" in protocol message object

我正在使用protocol-bufferspythonlib发送数据,但它有一些问题,所以Traceback(mostrecentcalllast):File"test_message.py",line17,inptask.task=taskFile"build\bdist.win32\egg\google\protobuf\internal\python_message.py",line513,insetterAttributeError:Assignmentnotallowedtocompositefield"_task"inprotocolmessageobject.src如下: