相当于Java ScheduledExecutorService的C语言库?
我想要一个线程池,允许在特定延迟后或在绝对时间安排作业,为此我将在 Java 中使用 ScheduledExecutorService
。有人熟悉提供同等功能的 C 库吗?实际上,我想要比 Java 提供的功能更多的东西:我希望根据需要创建新线程,而不是从固定大小的池中选择,这相当于 java.util.concurrent.Executors 实现类似 newCachedScheduledThreadPool()
方法的方法。看来我想要很多,圣诞节了吗?
I want a thread pool that will allow jobs to be scheduled after a specific delay or at an absolute time, for which I would use ScheduledExecutorService
in Java. Is anybody familiar with a C library providing equivalent functionality? Actually, I want something with even more features than provided by Java: I want new threads to be created as necessary instead of being chosen from a fixed-size pool, which would be the equivalent of java.util.concurrent.Executors
implementing something like a newCachedScheduledThreadPool()
method. Seems like I want a lot, is it Christmas yet?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试使用 Glib 作为线程池:
http://developer.gnome.org /glib/2.28/glib-Thread-Pools.html
我知道这并不能完全为您提供 ScheduledExecutorService 的等价物,但似乎编写一些包装器代码应该相对容易可以实现调度部分。
You might try Glib for thread pools:
http://developer.gnome.org/glib/2.28/glib-Thread-Pools.html
I know this doesn't quite give you the equivalent of ScheduledExecutorService, but it seems it should be relatively easy to write some wrapper code which could implement the scheduling part.