关于多线程中的TEvent类在新建对象时的参数问题

慎思 2018-05-13 09:37:00
在学习BCB的多线程时,遇到一个例子在新建TEvent类对象时的语句如下:

TEvent *BeginProduce = new TEvent(NULL,false,ture,"TestEvent1")

想知道()里面的参数都代表什么啊
...全文
433 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ooolinux 2018-05-14
  • 打赏
  • 举报
回复
引用 5 楼 dhuhan 的回复:
[quote=引用 3 楼 u010165006 的回复:] 参考: (BCB)C++ Builder 6.0在Win7下如何使用帮助Help http://blog.163.com/tab_98/blog/static/1192409720160251029113/ Help——索引——TEvent——TEvent(VCL)——Methods——构造函数(或者Create函数,即Delphi的构造函数,VCL是Delphi和CB通用的)
嗯,找到了,之前help的时候以为构造函数就是Constructor,没看到Constructor还以为没有构造函数。。。[/quote] 一般构造函数名和类名相同。
慎思 2018-05-14
  • 打赏
  • 举报
回复
引用 3 楼 u010165006 的回复:
参考: (BCB)C++ Builder 6.0在Win7下如何使用帮助Help http://blog.163.com/tab_98/blog/static/1192409720160251029113/ Help——索引——TEvent——TEvent(VCL)——Methods——构造函数(或者Create函数,即Delphi的构造函数,VCL是Delphi和CB通用的)
嗯,找到了,之前help的时候以为构造函数就是Constructor,没看到Constructor还以为没有构造函数。。。
titan_ysl 2018-05-14
  • 打赏
  • 举报
回复
win10的下可用的winhlp32,装上后,在c++builder 6.0中,用鼠标选中控件或文字,按F1就能查帮助了, https://pan.baidu.com/s/1dwf0lNZg1pm2aGOBDmVaWQ
ooolinux 2018-05-14
  • 打赏
  • 举报
回复
参考: (BCB)C++ Builder 6.0在Win7下如何使用帮助Help http://blog.163.com/tab_98/blog/static/1192409720160251029113/ Help——索引——TEvent——TEvent(VCL)——Methods——构造函数(或者Create函数,即Delphi的构造函数,VCL是Delphi和CB通用的)
draculamx 2018-05-14
  • 打赏
  • 举报
回复
emb官网地址: http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/SyncObjs_TEvent_Create@Boolean.html
draculamx 2018-05-14
  • 打赏
  • 举报
回复
__fastcall TEvent(PSecurityAttributes EventAttributes, Boolean ManualReset, Boolean InitialState, const AnsiString Name, Boolean UseCOMWait = False); __fastcall TEvent(Boolean UseCOMWait = False); Description Call Create to create a TEvent object. Create can generate a new event object or can provide access to an existing named event object. Set the EventAttributes parameter to specify the access rights and inheritance capabilities of the new event object. Calling Create with EventAttributes set to nil (Delphi) or NULL (C++) creates an event object with a default set of security attributes. If the TEvent object is created to access an existing named event object, only the bInheritHandle field of EventAttributes is used, as the access rights were determined when the event object was created. Set ManualReset to specify whether the signal of the TEvent object can only be turned off by a call to the ResetEvent method, or whether it is automatically reset when a single waiting thread is released. When ManualReset is true, the TEvent signal stays set until the ResetEvent method turns it off. When ManualReset is false, the signal is automatically turned off when only a single thread waits on the signal and that thread is released. If the TEvent object is created to access an existing named event object, the ManualReset parameter is ignored. Set InitialState to indicate whether the TEvent object should be created with the signal set, or turned off. When InitialState is true, the TEvent object is created with the signal set. If the TEvent object is created to access an existing named event object, the InitialState parameter is ignored. Set Name to provide a name for a new event object or to specify an existing named event object. If no other thread or process will need to access the event object to wait for its signal, Name can be left blank. Name can be a string of up to 260 characters, not including the backslash character (\). If Name is used to specify an existing event object, the value must match the name of the existing event in a case-sensitive comparison. If Name matches the name of an existing semaphore, mutex, or file-mapping object, the TEvent object will be created with Handle set to 0 and all method calls will fail. Set UseCOMWait to True to ensure that when a thread is blocked and waiting for the object, any STA COM calls can be made back into this thread. 详细可以去emb的官网看,这段话就是官网上的,如果想看中文,直接去百度搜 “EVENT windows API”就行,这个其实就是封装了windows的CreateEvent函数

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧