SDL_Delay() 线程安全吗?

发布于 2024-10-09 16:04:41 字数 173 浏览 0 评论 0原文

我一直在开发一个使用 SDL 的 C++ 项目,想知道从不同线程同时调用 SDL_Delay 是否安全,或者我是否需要编写一个包装器来序列化对该函数的访问。我宁愿避免任何开销,因为我需要的延迟非常小。

有人尝试过这个吗?

我在 OS X 和 pthreads 上使用 c++,并且需要代码是可移植的。

I have been working on a C++ project that uses SDL, and wonder if it is safe to call SDL_Delay concurrently from different threads or if I need to write a wrapper to serialize access to the function. I rather avoid any overhead, as the delays I need are very small.

Has anyone have tried this?

I am using c++ on OS X and pthreads, and need the code to be portable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

老子叫无熙 2024-10-16 16:04:41

我对 SDL_Delay 没有任何直接经验,但根据:此文档< /a> 它不是线程安全的,您可能应该使用包装器。

I don't have any direct experience with SDL_Delay but according to: this documentation it is not thread safe and you should probably use a wrapper.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文