English 中文(简体)
同时执行职务
原标题:Simultaneous Execution of Functions

我提出的申请必须执行太长的职能(称为“<>条码>>slowfunc(),这是一个问题,因为我的申请是用视频直播材料进行的。 通过执行这一职能,框架比率受到严重影响。

Is there a way to run slowfunc() in the background without using threading? I don t necessarily need it to run every frame, but every time it finishes, I d like to examine the output. The only thing I can think of right now is to split up slowfunc() into several "mini-functions" which would each take approximately an equal amount of time, then run one minifunction per frame. However, slowfunc() is a relatively complex function, and I feel that there should be (hopefully is) a way to do this simply.

EDIT:我可以使用透镜,因为这一方案最终将被用于可能不支持翻新的小型机器人。 我猜测我可以使用“合作多味”。 感谢你们的帮助!

最佳回答

在计算完成后,将睡觉,直至再进行计算。 这样,你们不会因为read子的开端而受到影响。

问题回答

You re asking for simaltaneous execution. The two ways to do this are -: a) Multi-threading -: Create another thread to run on a background. b) MUlti-processing -: Create another process . Take all inputs required for the function via a shared memory model. Create a synchronisation mechanism with original process(parent process). Execute this function.

通常倾向于使用第1条。 加快执行。

第2条保证,如果该功能坠毁,你的母体过程依然有效。 虽然这是不相干的,因为为什么你想要孩子(功能)坠毁。 这需要更多记忆。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签