TSynchroObject::WaitFor - C++ Builder

C++ Builder 参考手册 ➙ TSynchroObject ➙ WaitFor


  • 头文件:#include
  • 命名空间:System::Syncobjs
  • 类:TSynchroObject
  • 访问权限:public:
  • 函数原型:
virtual System::Types::TWaitResult __fastcall WaitFor(
    unsigned Timeout = (unsigned)(0xffffffff));

System::Types::TWaitResult __fastcall WaitFor(
    const System::Timespan::TTimeSpan &Timeout);

System::Syncobjs::TSynchroObject::WaitFor 是 System::Syncobjs::TSynchroObject
的成员函数,等待事件

参数:
Timeout:等待事件超时的时间,默认值 0xffffffff 为无限等待

返回值:

  • WaitFor 方法会阻止线程继续执行,一直到事件产生,或者超时;
  • TSynchroObject 类并没有实现这个功能,子类需要重载这个函数来实现功能;
  • TSynchroObject 类的 Acquire 方法调用了 WaitFor,如果子类没有重载 Acquire 方法实现功能,那么 Acquire 方法就相当于调用默认参数的 WaitFor。

参考:

  • System::Syncobjs::TSynchroObject::Acquire
  • System::Syncobjs::TSynchroObject::Release
  • System::Syncobjs::TCriticalSection
  • System::Syncobjs::TEvent
  • System::Syncobjs::TMutex
  • System::Classes::TThread
  • System::TObject
  • VCL 类继承关系

C++ Builder 参考手册 ➙ TSynchroObject ➙ WaitFor

你可能感兴趣的:(TSynchroObject::WaitFor - C++ Builder)