Questions tagged «threading»

1
由于多线程缓存崩溃,因此可以替代get_posts()
我正在使用pthreads创建多个线程。每个线程在某一时刻都尝试使用get_posts()如下: $args = array( 'post_type' => 'post', 'post_status' => 'any' ); $posts_list = get_posts($args); 但是,我最终遇到以下崩溃: HP Fatal error: Call to a member function get() on a non-object in C:\dev\wordpress\wp-includes\cache.php on line 123 请注意,当我get_posts()在没有线程的代码段中进行相同的调用时,我没有崩溃。 现在,我的问题是,如何get_posts()从pthread线程中调用?如果我做不到,那有什么选择呢? 谢谢。 更新资料 这是示例代码 class My_Thread extends Thread { public function run() { /* DO SOME STUFF …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.