看了VCL的Form部分,很多不明白的。请教constructor TCustomForm.Create(AOwner: TComponent);
begin
GlobalNameSpace.BeginWrite;
try
CreateNew(AOwner);
if (ClassType <> TForm) and not (csDesigning in ComponentState) then
begin
Include(FFormState, fsCreating);
try
if not InitInheritedComponent(Self, TForm) then
raise EResNotFound.CreateFmt(SResNotFound, [ClassName]);
finally
Exclude(FFormState, fsCreating);
end;
if OldCreateOrder then DoCreate;
end;
finally
GlobalNameSpace.EndWrite;
end;
end;一看就知道是作用是创建还有必要的初始化。不过,问题来了:
GlobalNameSpace干什么的?
GlobalNameSpace.BeginWrite 的作用?IReadWriteSync里怎么没有实现?
Include(FFormState, fsCreating) 的作用?
Exclude(FFormState, fsCreating) 的作用?
GlobalNameSpace.EndWrite 的作用?IReadWriteSync里怎么没有实现?
begin
GlobalNameSpace.BeginWrite;
try
CreateNew(AOwner);
if (ClassType <> TForm) and not (csDesigning in ComponentState) then
begin
Include(FFormState, fsCreating);
try
if not InitInheritedComponent(Self, TForm) then
raise EResNotFound.CreateFmt(SResNotFound, [ClassName]);
finally
Exclude(FFormState, fsCreating);
end;
if OldCreateOrder then DoCreate;
end;
finally
GlobalNameSpace.EndWrite;
end;
end;一看就知道是作用是创建还有必要的初始化。不过,问题来了:
GlobalNameSpace干什么的?
GlobalNameSpace.BeginWrite 的作用?IReadWriteSync里怎么没有实现?
Include(FFormState, fsCreating) 的作用?
Exclude(FFormState, fsCreating) 的作用?
GlobalNameSpace.EndWrite 的作用?IReadWriteSync里怎么没有实现?
解决方案 »
- 导师要求做一个家庭理财软件,多个用户可以使用,是一个用户再多建一张表吗,小弟不会弄啊,求助
- 从bpl调用的MDI表单关闭后,为何在MDImainform的MDICHILD中还保留着?
- 关于ParamStr和ParamCount的问题
- 新西兰大学计算机专业的考试题,你会吗?请提供答案。
- [原创] 10K 的贝塞尔曲线程序,Delphi编译的SDK程序,欢迎指教!
- 使用INDY的的POP3时经常遇到这个问题(解答的人100分):
- 急,重分求助
- 如何使一个窗体不随意退出,简单的问题
- 如何判断网络中某一台计算机是否存在(TCP/IP)?
- 有人知道哪里有制作系统托盘的控件?(附带教我用)
- 如何实现对于TreeView组件的复选!
- 今天找到份工作 散分 还有些问题请教大家
IReadWriteSync是一个接口定义, 在WINDOWS中他是通过TMultiReadExclusiveWriteSynchronizer这个类来实现的,在CLX中是通过TSimpleRWSync这个类来实现的。
下面的代码来自CLASSES中初始化部分。
{$IFDEF MSWINDOWS}
GlobalNameSpace := TMultiReadExclusiveWriteSynchronizer.Create;
{$ENDIF}
{$IFDEF LINUX}
GlobalNameSpace := TSimpleRWSync.Create;
{$ENDIF}
Include(FFormState, fsCreating) 的作用?
FFormState是一个SET, 这句就是让FFormState里包含fsCreating这个值
Exclude(FFormState, fsCreating) 的作用?
去掉fsCreating这个值
GlobalNameSpace干什么的?这个作用请看:
Use TMultiReadExclusiveWriteSynchronizer to guard access to memory in a multi-threaded application. Unlike a critical section, which blocks all other threads from reading or writing its associated memory, TMultiReadExclusiveWriteSynchronizer allows multiple threads to read from the protected memory simultaneously, while ensuring that any thread writing to the memory has exclusive access.In applications where threads read from an object or variable frequently and only write to it occasionally, using the multi-read exclusive-write synchronizer instead of a critical section can result in considerable performance improvement.All access to the protected memory must be bracketed by calls to the BeginRead and EndRead or BeginWrite and EndWrite methods. Any thread that reads from or writes to this memory without using these calls can introduce thread conflicts.
谢谢至于你最后说的,都是E文。偶的E文不好。所以你白Paste了
给点中文的好么?
VCL面太大了。看不过来