critical section failing

From: Brad White (bwhite)
Date: 12/30/03


Date: Tue, 30 Dec 2003 15:52:57 -0600

Please take a look at this code.
It looks to me like it should write out the
message twice and then deadlock, but
it doesn't. Why??
-------
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  StrUtils,
  SyncObjs;

var
  Lock : TCriticalSection;
  StackCount : Integer;

procedure doDeadLock;
begin
  WriteLn(Format('Doing Deadlock (%d)',[StackCount]));
  Inc(StackCount);
  Lock.Enter;
  doDeadLock;
end;

begin
  Lock := TCriticalSection.Create;
  doDeadLock;
end.
-----------
Happy New Year,
Brad White



Relevant Pages

  • Re: critical section failing
    ... "Brad White" wrote in message ... > Lock: TCriticalSection; ... > procedure doDeadLock; ... > WriteLn(Format('Doing Deadlock (%d)',)); ...
    (borland.public.delphi.language.objectpascal)
  • Re: [patch] Real-Time Preemption, -RT-2.6.10-rc1-mm3-V0.7.18
    ... I got the attached deadlock report. ... Nov 8 04:19:32 eran kernel: PREEMPT ... Nov 8 04:19:32 eran kernel: kjournald:1445 BUG: lock held at task exit time! ...
    (Linux-Kernel)
  • Re: deadlock when reading most currently inserted records
    ... Our solution is to use ROWLOCK hints on all INSERT, UPDATE, and DELETE ... > select obtaining a shared lock, then the insert obtaining an IX lock at ... Printing deadlock information ... > SPID: 53, ECID: 0, Not Blocking ...
    (microsoft.public.sqlserver.programming)
  • Re: [RFC, PATCH] locks: remove posix deadlock detection
    ... Thread A of task B takes lock 1 ... We currently declare deadlock at this point (unless the deadlock detection ... locked region is put to sleep by attempting to lock another ...
    (Linux-Kernel)
  • Re: spurious -ENOSPC on XFS
    ... hold an inode lock. ... However, it shouldn't deadlock because ... the flush and if the flush is done with xfs_sync_inodes: ...
    (Linux-Kernel)