Thin Locks in D

Lionello Lunesu lionello at lunesu.remove.com
Thu Jul 24 20:19:52 PDT 2008


"Walter Bright" <newshound1 at digitalmars.com> wrote in message 
news:g6b1ae$up4$1 at digitalmars.com...
> http://bartoszmilewski.wordpress.com/2008/07/24/thin-locks-in-d/
>
> and of course on reddit:
>
> http://www.reddit.com/comments/6tbzc/thin_locks_in_d/

I remember reading somewhere that critical-sections on Windows do just that. 
It sure appears that it does from WinNT.h :

typedef struct _RTL_CRITICAL_SECTION {
    PRTL_CRITICAL_SECTION_DEBUG DebugInfo;

    //
    //  The following three fields control entering and exiting the critical
    //  section for the resource
    //

    LONG LockCount;
    LONG RecursionCount;
    HANDLE OwningThread;        // from the thread's ClientId->UniqueThread
    HANDLE LockSemaphore;
    ULONG_PTR SpinCount;        // force size on 64-bit systems when packed
} RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;

(from WinBase.h: typedef RTL_CRITICAL_SECTION CRITICAL_SECTION;)

L. 




More information about the Digitalmars-d mailing list