0
我正在使用NaCl写一个屏幕记录器,在一个线程内我想打开一个文件。该文件需要一些时间才能打开。我想阻止fopen直到完成,然后移动到下一行代码。我试图使用pp::BlockUntilComplete()
但它没有解决。在继续前进之前,确保fopen完成的解决方案是什么?Nacl_IO阻塞线程,直到fopen完成
我尝试相同的代码之后的某个时间(直到线程结束了,它的工作)
Calling thread
video_track_.GetFrame(m_callback_factory.NewCallbackWithOutput(
&EncoderInstance::OnGetFrame));
Called function
void EncoderInstance::OnGetFrame(
int32_t result, pp::VideoFrame frame) {
if (result != PP_OK)
return;
outfile = fopen("/persistent/cuc_ieschool.ivf", "wb");
if(outfile==NULL){
PostMessage("Can not open output file\n");
return;
}
我创建了一个新的线程,但我无法弄清楚如何阻止这个调用,即使这个调用是在一个线程中。我只是不知道如何阻止通话 –