求解!临界区!解决方法

求解!临界区!
Delphi(Pascal) code
Var
FCList: TThreadList; 
function TMainfrm.FindMyClient(AThread: Pointer): PMyClient;
var
  i:Integer;
begin
  Result:=nil;
  try
    //FCList.UnlockList;
    with FCList.LockList do
    begin
      for i := 0 to Count-1 do
      begin
       //doing
      end;
    end;
  finally
    FCList.UnlockList;
  end;
end;
  end;


为什么我这样操作 FCList 感觉还是没有离开临界区, 下次访问就卡在临界区了 
在with FCList.LockList do 前面加上 FCList.UnlockList; 又正常了,明显finally 的UnlockList没启作用样的!
是我的代码写错了吗?


------解决方案--------------------
LZ你这个操作不是临界区吧,只是把FCList这个list的指针锁住了,也就是加锁时,别的线程不能访问该对象而已
,第二次访问当然锁住了
临界区是CriticalSection,况且就算是临界区,也是一个线程进入,其他尝试进入的线程会挂起啊
------解决方案--------------------
会不会你的end对错了?后面怎么多出一个end?
------解决方案--------------------
估计是代码没贴全,上面还有一个var呢