Fast Reader/Writer lock in C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace Locks
{
    /// <summary>
    /// Condition Variable (CV) class.
    /// </summary>
    public class CV
    {
        private readonly object syncLock = new object(); // Internal lock.
        private readonly object m;                       // The lock associated with this CV.
        public CV(object m)
        {
            lock ( syncLock )
            {
                this.m = m;
            }
        }
        public void Wait()
        {
            bool enter = false;
            try
            {
                lock ( syncLock )
                {
                    Monitor.Exit(m);
                    enter = true;
                    Monitor.Wait(syncLock);
                }
            }
            finally
            {
                if ( enter )
                    Monitor.Enter(m);
            }
        }
        public void Pulse()
        {
            lock ( syncLock )
            {
                Monitor.Pulse(syncLock);
            }
        }
        public void PulseAll()
        {
            lock ( syncLock )
            {
                Monitor.PulseAll(syncLock);
            }
        }
    }
    public sealed class RW
    {
        private readonly object syncRoot = new object();    // Internal lock.
        private int i = 0;                                  // 0 or greater means readers can pass; -1 is active writer.
        private int readWaiters = 0;                        // Readers waiting for writer to exit.
        private int writeWaiters = 0;                       // Writers waiting for writer lock.
        private CV wQ;                                      // Condition variable.
        public RW()
        {
            wQ = new CV(syncRoot);
        }
        /// <summary>
        /// Gets a value indicating if a reader lock is held.
        /// </summary>
        public bool IsReaderLockHeld
        {
            get
            {
                lock ( syncRoot )
                {
                    if ( i > 0 )
                        return true;
                    return false;
                }
            }
        }
        /// <summary>
        /// Gets a value indicating if the writer lock is held.
        /// </summary>
        public bool IsWriterLockHeld
        {
            get
            {
                lock ( syncRoot )
                {
                    if ( i < 0 )
                        return true;
                    return false;
                }
            }
        }
        /// <summary>
        /// Aquires the writer lock.
        /// </summary>
        public void AcquireWriterLock()
        {
            lock ( syncRoot )
            {
                writeWaiters++;
                while ( i != 0 )
                    wQ.Wait();      // Wait until existing writer frees the lock.
                writeWaiters–;
                i = -1;             // Thread has writer lock.
            }
        }
        /// <summary>
        /// Aquires a reader lock.
        /// </summary>
        public void AcquireReaderLock()
        {
            lock ( syncRoot )
            {
                readWaiters++;
                // Defer to a writer (one time only) if one is waiting to prevent writer starvation.
                if ( writeWaiters > 0 )
                {
                    wQ.Pulse();
                    Monitor.Wait(syncRoot);
                }
                while ( i < 0 )
                    Monitor.Wait(syncRoot);
                readWaiters–;
                i++;
            }
        }
        /// <summary>
        /// Releases the writer lock.
        /// </summary>
        public void ReleaseWriterLock()
        {
            bool doPulse = false;
            lock ( syncRoot )
            {
                i = 0;
                // Decide if we pulse a writer or readers.
                if ( readWaiters > 0 )
                {
                    Monitor.PulseAll(syncRoot); // If multiple readers waiting, pulse them all.
                }
                else
                {
                    doPulse = true;
                }
            }
            if ( doPulse )
                wQ.Pulse();                     // Pulse one writer if one waiting.
        }
        /// <summary>
        /// Releases a reader lock.
        /// </summary>
        public void ReleaseReaderLock()
        {
            bool doPulse = false;
            lock ( syncRoot )
            {
                i–;
                if ( i == 0 )
                    doPulse = true;
            }
            if ( doPulse )
                wQ.Pulse();                     // Pulse one writer if one waiting.
        }
    } // RW
}
About these ads
This entry was posted in C#. Bookmark the permalink.

10 Responses to Fast Reader/Writer lock in C#

  1. Unknown says:

    http://www.batteryfast.com/dell/latitude-d820.htm Dell latitude d820 Battery http://www.batteryfast.com/dell/latitude-d830.htm Dell latitude d830 Battery http://www.batteryfast.com/acer/aspire-5520.htm Acer aspire 5520 Battery http://www.batteryfast.com/acer/aspire-5920.htm Acer aspire 5920 Battery http://www.batteryfast.com/acer/batbl50l6.htm Acer batbl50l6 Battery http://www.batteryfast.com/dell/6400.htm Dell 6400 Battery http://www.batteryfast.com/dell/d620.htm Dell d620 Battery http://www.batteryfast.com/dell/d630.htm Dell d630 Battery http://www.batteryfast.com/dell/d820.htm Dell d820 Battery http://www.batteryfast.com/dell/d830.htm Dell d830 Battery http://www.batteryfast.com/dell/e1505.htm Dell e1505 Battery http://www.batteryfast.com/dell/gd761.htm Dell gd761 Battery http://www.batteryfast.com/dell/gk479.htm Dell gk479 Battery http://www.batteryfast.com/dell/inspiron-1520.htm Dell inspiron 1520 Battery http://www.batteryfast.com/dell/inspiron-6400.htm Dell inspiron 6400 Battery http://www.batteryfast.com/mitac/bp-8×99.htm Mitac bp-8×99 Battery http://www.batteryfast.com/sony/vgp-bps2.htm Sony vgp-bps2 Battery http://www.batteryfast.com/sony/vgp-bps2a.htm Sony vgp-bps2a Battery http://www.batteryfast.com/sony/vgp-bps2b.htm Sony vgp-bps2b Battery http://www.batteryfast.com/sony/vgp-bps2c.htm Sony vgp-bps2c Battery http://www.batteryfast.com/sony/vgp-bps5.htm Sony vgp-bps5 Battery http://www.batteryfast.com/sony/vgp-bps5a.htm Sony vgp-bps5a Battery http://www.batteryfast.com/hp/530.htm Hp 530 Battery http://www.batteryfast.com/hp/dv2000.htm Hp dv2000 Battery http://www.batteryfast.com/hp/dv2200.htm Hp dv2200 Battery http://www.batteryfast.com/hp/dv4000.htm Hp dv4000 Battery http://www.batteryfast.com/hp/dv6000.htm Hp dv6000 Battery http://www.batteryfast.com/acer/batbl50l6.htm Acer batbl50l6 Battery http://www.batteryfast.com/hp/nc8230.htm Hp nc8230 Battery http://www.batteryfast.com/hp/nc8430.htm Hp nc8430 Battery http://www.batteryfast.com/hp/nw8000.htm Hp nw8000 Battery http://www.batteryfast.com/hp/nw8200.htm Hp nw8200 Battery http://www.batteryfast.com laptop battery http://www.batteryfast.com laptop batteries http://www.batteryfast.com/laptop-ac-adapter/acer/acer-19V-3.42A-65w-5.5mm-1.5mm-small-head.php Acer 1600 1680 19V 3.42A 65W 5.5MM*1.7MM Adapter http://www.batteryfast.com/laptop-ac-adapter/acer/acer-19V-3.42A-65w-5.5mm-2.5mm-big-head.php Acer 1600 1680 19V 3.42A 65W 5.5MM*2.5MM Adapter http://www.batteryfast.com/laptop-ac-adapter/toshiba/toshiba-15V-5A-75w-6.3mm-3.0mm.php Toshiba PA3283U-1ACA 15V 5A 75W 6.3MM*3.0MM Adapter http://www.batteryfast.com/laptop-ac-adapter/toshiba/toshiba-19V-3.42A-65w-5.5mm-2.5mm.php Toshiba PA3467U PA3396U 19V 3.42A 65W 5.5MM*2.5MM Adapter http://www.batteryfast.com/laptop-ac-adapter/toshiba/toshiba-19V-4.74A-90w-5.5mm-2.5mm.php Toshiba PA3589U 19V 4.74A 90W 5.5MM*2.5MM Adapter http://www.batteryfast.com/laptop-ac-adapter/asus/asus-19v-3.42A-65w-5.5mm-2.5mm.php Asus A2 A3 19V 3.42A 65W 5.5MM*2.5MM Adapter http://www.batteryfast.com/laptop-ac-adapter/dell/dell-19.5V-3.34A-65w-7.4mm-5.0mm-with-pin-pa-12.php Dell 6400 D620 19.5V 3.34A 65W 7.4MM*5.0MM Adapter

  2. Unknown says:

    http://www.topbattery.com.au/dell/latitude-d630.htm Dell latitude d630 Batteryhttp://www.topbattery.com.au/dell/latitude-d810.htm Dell latitude d810 Batteryhttp://www.topbattery.com.au/dell/latitude-d820.htm Dell latitude d820 Batteryhttp://www.topbattery.com.au/dell/latitude-d830.htm Dell latitude d830 Batteryhttp://www.topbattery.com.au/dell/vostro-1000.htm Dell vostro 1000 Batteryhttp://www.topbattery.com.au/dell/vostro-1500.htm Dell vostro 1500 Batteryhttp://www.topbattery.com.au/dell/vostro-1700.htm Dell vostro 1700 Batteryhttp://www.topbattery.com.au/dell/wr050.htm Dell wr050 Batteryhttp://www.topbattery.com.au/dell/xps-m1210.htm Dell xps m1210 Batteryhttp://www.topbattery.com.au/dell/xps-m1330.htm Dell xps m1330 Batteryhttp://www.topbattery.com.au/dell/xps-m140.htm Dell xps m140 Batteryhttp://www.topbattery.com.au/dell/xps-m1530.htm Dell xps m1530 Batteryhttp://www.topbattery.com.au/dell/xps-m1730.htm Dell xps m1730 Batteryhttp://www.topbattery.com.au/hp/510.htm Hp 510 Batteryhttp://www.topbattery.com.au/hp/530.htm Hp 530 Batteryhttp://www.topbattery.com.au/hp/dv2000.htm Hp dv2000 Batteryhttp://www.topbattery.com.au/hp/dv6000.htm Hp dv6000 Batteryhttp://www.topbattery.com.au/hp/dv6500.htm Hp dv6500 Batteryhttp://www.topbattery.com.au/hp/dv9000.htm Hp dv9000 Batteryhttp://www.topbattery.com.au/sony/vgp-bps2b.htm Sony vgp-bps2b Batteryhttp://www.topbattery.com.au/toshiba/pa3285u-1bas.htm Toshiba pa3285u-1bas Batteryhttp://www.topbattery.com.au/toshiba/pa3285u-1brs.htm Toshiba pa3285u-1brs Batteryhttp://www.topbattery.com.au/sony/vgp-bps5a.htm Sony vgp-bps5a Batteryhttp://www.topbattery.com.au/toshiba/pa3356u.htm Toshiba pa3356u Batteryhttp://www.topbattery.com.au/toshiba/pa3356u-3bas.htm Toshiba pa3356u-3bas Batteryhttp://www.batterylaptoppower.com laptop batteryhttp://www.batterylaptoppower.com laptop batterieshttp://www.topbattery.com.au/toshiba/pa3399u-1bas.htm Toshiba pa3399u-1bas Batteryhttp://www.topbattery.com.au/toshiba/pa3399u-1brs.htm Toshiba pa3399u-1brs Batteryhttp://www.topbattery.com.au/toshiba/pa3399u-2bas.htm Toshiba pa3399u-2bas Batteryhttp://www.topbattery.com.au/toshiba/pa3533u-1bas.htm Toshiba pa3533u-1bas Batteryhttp://www.topbattery.com.au/toshiba/pa3533u-1brs.htm Toshiba pa3533u-1brs Batteryhttp://www.topbattery.com.au/toshiba/pa3534u-1bas.htm Toshiba pa3534u-1bas Batteryhttp://www.topbattery.com.au/hp/nc6100.htm Hp nc6100 Batteryhttp://www.topbattery.com.au/hp/nc6120.htm Hp nc6120 Batteryhttp://www.topbattery.com.au/hp/nc6120.htm Hp nc6200 Batteryhttp://www.topbattery.com.au/hp/nc6400.htm Hp nc6400 Batteryhttp://www.topbattery.com.au/hp/nc8230.htm Hp nc8230 Batteryhttp://www.topbattery.com.au/hp/nx6100.htm Hp nx6100 Batteryhttp://www.topbattery.com.au/hp/nx6120.htm Hp nx6120 Batteryhttp://www.topbattery.com.au/hp/pavilion-dv2000.htm Hp pavilion dv2000 Batteryhttp://www.topbattery.com.au/hp/pavilion-dv6000.htm Hp pavilion dv6000 Batteryhttp://www.topbattery.com.au/hp/pavilion-tx2000.htm Hp pavilion tx2000 Batteryhttp://www.topbattery.com.au/ibm/thinkpad-r60.htm Ibm thinkpad r60 Batteryhttp://www.topbattery.com.au/ibm/thinkpad-t40.htm Ibm thinkpad t40 Batteryhttp://www.topbattery.com.au/ibm/thinkpad-t42.htm Ibm thinkpad t42 Battery

  3. Unknown says:

    http://www.topbattery.com.au/toshiba/pa3285u-3brs.htm Toshiba pa3285u-3brs Batteryhttp://www.topbattery.com.au/asus/a32-f3.htm Asus a32-f3 Batteryhttp://www.topbattery.com.au/asus/f3.htm Asus f3 Batteryhttp://www.topbattery.com.au/toshiba/pa3285u-3bas.htm Toshiba pa3285u-3bas Batteryhttp://www.topbattery.com.au/laptop-ac-adapter/dell/d620.htm Dell d620 Adapterhttp://www.topbattery.com.au/acer/as07b41.htm Acer as07b41 Batteryhttp://www.topbattery.com.au/acer/aspire-5500.htm Acer aspire 5500 Batteryhttp://www.topbattery.com.au/acer/aspire-9300-series.htm Acer aspire 9300 series Batteryhttp://www.batterylaptoppower.com/laptop-ac-adapter/ laptop ac adapterhttp://www.batterylaptoppower.com/laptop-ac-adapter/ laptop ac adaptershttp://www.topbattery.com.au/apple/a1185.htm Apple a1185 Batteryhttp://www.topbattery.com.au/apple/a1185-black.htm Apple a1185 black Batteryhttp://www.topbattery.com.au/apple/a1185-white.htm Apple a1185 white Batteryhttp://www.topbattery.com.au/asus/a42-a4.htm Asus a42-a4 Batteryhttp://www.topbattery.com.au/asus/a42-v6.htm Asus a42-v6 Batteryhttp://www.topbattery.com.au/clevo/d400.htm Clevo d400 Batteryhttp://www.topbattery.com.au/clevo/d470w.htm Clevo d470w Batteryhttp://www.batterylaptoppower.com laptop batteryhttp://www.batterylaptoppower.com laptop batterieshttp://www.topbattery.com.au/compaq/dv4000.htm Compaq dv4000 Batteryhttp://www.topbattery.com.au/compaq/dv6000.htm Compaq dv6000 Batteryhttp://www.topbattery.com.au/compaq/dv6500.htm Compaq dv6500 Batteryhttp://www.topbattery.com.au/compaq/presario-v4000.htm Compaq presario v4000 Batteryhttp://www.topbattery.com.au/dell/1501.htm Dell 1501 Batteryhttp://www.topbattery.com.au/dell/6400.htm Dell 6400 Batteryhttp://www.topbattery.com.au/dell/d620.htm Dell d620 Batteryhttp://www.topbattery.com.au/dell/d630.htm Dell d630 Batteryhttp://www.topbattery.com.au/dell/d820.htm Dell d820 Batteryhttp://www.topbattery.com.au/dell/d830.htm Dell d830 Batteryhttp://www.topbattery.com.au/dell/e1505.htm Dell e1505 Batteryhttp://www.topbattery.com.au/dell/gd761.htm Dell gd761 Batteryhttp://www.topbattery.com.au/dell/gk479.htm Dell gk479 Batteryhttp://www.topbattery.com.au/dell/inspiron-1000.htm Dell inspiron 1000 Batteryhttp://www.topbattery.com.au/dell/inspiron-1520.htm Dell inspiron 1520 Batteryhttp://www.topbattery.com.au/dell/inspiron-6400.htm Dell inspiron 6400 Batteryhttp://www.topbattery.com.au/dell/inspiron-1521.htm Dell inspiron 1521 Batteryhttp://www.topbattery.com.au/dell/inspiron-6400.htm Dell inspiron 6400 Batteryhttp://www.topbattery.com.au/dell/inspiron-1720.htm Dell inspiron 1720 Batteryhttp://www.topbattery.com.au/dell/inspiron-500m.htm Dell inspiron 500m Batteryhttp://www.topbattery.com.au/dell/inspiron-6000.htm Dell inspiron 6000 Batteryhttp://www.topbattery.com.au/dell/inspiron-9300.htm Dell inspiron 9300 Batteryhttp://www.topbattery.com.au/dell/inspiron-9400.htm Dell inspiron 9400 Batteryhttp://www.topbattery.com.au/dell/kd476.htm Dell kd476 Batteryhttp://www.topbattery.com.au/dell/kr-onx511.htm Dell kr-onx511 Batteryhttp://www.topbattery.com.au/dell/latitude-d620.htm Dell latitude d620 Battery

  4. Unknown says:

    http://www.batteryfast.com/dell/latitude-c400.htm Dell latitude c400 Battery http://www.batteryfast.com/dell/latitude-d531.htm Dell latitude d531 Battery http://www.batteryfast.com/dell/latitude-d610.htm Dell latitude d610 Battery http://www.batteryfast.com/dell/pc764.htm Dell pc764 Battery http://www.batteryfast.com/dell/precision-m65.htm Dell precision m65 Battery http://www.batteryfast.com/dell/precision-m70.htm Dell precision m70 Battery http://www.batteryfast.com/gateway/m505.htm Gateway m505 Battery http://www.batteryfast.com/gateway/m680.htm Gateway m680 Battery http://www.batteryfast.com/gateway/8msbg.htm Gateway 8msbg Battery http://www.batteryfast.com/gateway/bat0016.htm Gateway bat0016 Battery http://www.batteryfast.com/gateway/btp-51b3.htm Gateway btp-51b3 Battery http://www.batteryfast.com/hp/7400.htm Hp 7400 Battery http://www.batteryfast.com/hp/510.htm Hp 510 Battery http://www.batteryfast.com/hp/dv8000.htm Hp dv8000 Battery http://www.batteryfast.com/hp/dv8100.htm Hp dv8100 Battery http://www.batteryfast.com/hp/dv8200.htm Hp dv8200 Battery http://www.batteryfast.com/hp/dv9000.htm Hp dv9000 Battery http://www.batteryfast.com/hp/dv9500.htm Hp dv9500 Battery http://www.batteryfast.com/hp/dv9600.htm Hp dv9600 Battery http://www.batteryfast.com/hp/dv9700.htm Hp dv9700 Battery http://www.batteryfast.com/hp/elitebook-8530w.htm Hp elitebook 8530w Battery http://www.batteryfast.com/mitac/bp-8050.htm Mitac bp-8050 Battery http://www.batteryfast.com/ibm/thinkpad-x40.htm Ibm thinkpad x40 Battery http://www.batteryfast.com/mitac/bp-8089.htm Mitac bp-8089 Battery http://www.batteryfast.com/ibm/thinkpad-t43.htm Ibm thinkpad t43 Battery http://www.batteryfast.com/mitac/b-8599.htm Mitac b-8599 Battery http://www.batteryfast.com/toshiba/pa3535u-1bas.htm Toshiba pa3535u-1bas Battery http://www.batteryfast.com/toshiba/pa3535u-1brs.htm Toshiba pa3535u-1brs Battery http://www.batteryfast.com/toshiba/pabas067.htm Toshiba pabas067 Battery http://www.batteryfast.com/toshiba/pabas069.htm Toshiba pabas069 Battery http://www.batteryfast.com/toshiba/satellite-a100.htm Toshiba satellite a100 Battery http://www.batteryfast.com/toshiba/pa3593u-1bas.htm Toshiba pa3593u-1bas Battery http://www.batteryfast.com/toshiba/satellite-a205.htm Toshiba satellite a205 Battery http://www.batteryfast.com/toshiba/satellite-a55.htm Toshiba satellite a55 Battery http://www.batteryfast.com/toshiba/satellite-a70.htm Toshiba satellite a70 Battery http://www.batteryfast.com/toshiba/satellite-l10.htm Toshiba satellite l10 Battery http://www.batteryfast.com/toshiba/satellite-l100.htm Toshiba satellite l100 Battery http://www.batteryfast.com/toshiba/satellite-l15.htm Toshiba satellite l15 Battery http://www.batteryfast.com/toshiba/satellite-m30.htm Toshiba satellite m30 Battery http://www.batteryfast.com/toshiba/satellite-m40.htm Toshiba satellite m40 Battery http://www.batteryfast.com/hp/pavilion-dv8000.htm HP pavilion dv8000 Battery http://www.batteryfast.com/hp/pavilion-dv8100.htm HP pavilion dv8100 Battery http://www.batteryfast.com/hp/pavilion-dv8200.htm HP pavilion dv8200 Battery http://www.batteryfast.com/toshiba/satellite-m55.htm Toshiba satellite m55 Battery

  5. Unknown says:

    http://www.batterylaptoppower.com/dell/inspiron-6400.htm Dell inspiron 6400 Battery http://www.batterylaptoppower.com/dell/vostro-1000.htm Dell vostro 1000 Battery http://www.batterylaptoppower.com/dell/e1505.htm Dell e1505 Battery http://www.batterylaptoppower.com/dell/1501.htm Dell 1501 Battery http://www.batterylaptoppower.com/dell/kd476.htm Dell kd476 Battery http://www.batterylaptoppower.com/dell/gd761.htm Dell gd761 Battery http://www.batterylaptoppower.com/hp/530.htm Hp 530 Battery http://www.batterylaptoppower.com/dell/d620.htm Dell d620 Battery http://www.batterylaptoppower.com/dell/d630.htm Dell d630 Battery http://www.batterylaptoppower.com/dell/d820.htm Dell d820 Battery http://www.batterylaptoppower.com/dell/d830.htm Dell d830 Battery http://www.batterylaptoppower.com/dell/latitude-d820.htm Dell latitude d820 Battery http://www.batterylaptoppower.com/sony/vgp-bps2b.htm Sony vgp-bps2b Battery http://www.batterylaptoppower.com/ibm/thinkpad-t30.htm Ibm thinkpad t30 Battery http://www.batterylaptoppower.com/dell/latitude-d830.htm Dell latitude d830 Battery http://www.batterylaptoppower.com/dell/precision-m65.htm Dell precision m65 Battery http://www.batterylaptoppower.com/dell/inspiron-6000.htm Dell inspiron 6000 Battery http://www.batterylaptoppower.com/dell/inspiron-9300.htm Dell inspiron 9300 Battery http://www.batterylaptoppower.com/dell/inspiron-9400.htm Dell inspiron 9400 Battery http://www.batterylaptoppower.com/dell/inspiron-e1705.htm Dell inspiron e1705 Battery http://www.batterylaptoppower.com/dell/d5318.htm Dell d5318 Battery http://www.batterylaptoppower.com/dell/inspiron-1520.htm Dell inspiron 1520 Battery http://www.batterylaptoppower.com/dell/inspiron-1720.htm Dell inspiron 1720 Battery http://www.batterylaptoppower.com/dell/vostro-1500.htm Dell vostro 1500 Battery http://www.batterylaptoppower.com/dell/vostro-1700.htm Dell vostro 1700 Battery http://www.batterylaptoppower.com/dell/original-inspiron-1525.htm Dell original inspiron 1525 Battery http://www.batterylaptoppower.com/dell/xps-m1210.htm Dell xps m1210 Battery http://www.batterylaptoppower.com/dell/inspiron-b130.htm Dell inspiron b130 Battery http://www.batterylaptoppower.com/dell/inspiron-1300.htm Dell inspiron 1300 Battery http://www.batterylaptoppower.com/hp/m2000.htm Hp m2000 Battery http://www.batterylaptoppower.com/hp/nc2400.htm Hp nc2400 Battery http://www.batterylaptoppower.com/mitac/bp-8×99.htm Mitac bp-8×99 Battery http://www.batterylaptoppower.com/sony/vgp-bps2c.htm Sony vgp-bps2c Battery http://www.batterylaptoppower.com/sony/vgp-bps2a.htm Sony vgp-bps2a Battery http://www.batterylaptoppower.com/sony/vgp-bps2b.htm Sony vgp-bps2b Battery http://www.batterylaptoppower.com/sony/vgp-bps2.htm Sony vgp-bps2 Battery http://www.batterylaptoppower.com/ibm/thinkpad-t30.htm Ibm thinkpad t30 Battery http://www.batterylaptoppower.com/hp/nc6000.htm Hp nc6000 Battery http://www.batterylaptoppower.com/hp/nx5000.htm Hp nx5000 Battery http://www.batterylaptoppower.com/hp/nc8000.htm Hp nc8000 Battery http://www.batterylaptoppower.com/mitac/bp-8050.htm Mitac bp-8050 Battery http://www.batterylaptoppower.com/hp/2510p.htm Hp 2510p Battery http://www.batterylaptoppower.com/gateway/m360.htm Gateway m360 Battery

  6. Unknown says:

    Serena Williams and the season of her contentwow gold,world of warcraft gold,buy wow gold,wow power leveling,cheap wow gold,world of warcraft power
    leveling,world of warcraft gold,buy wow
    gold,ffxi gil,buy
    wow gold,wow power
    leveling,ffxi gil,world
    of warcraft power leveling,sell wow gold,wow power
    level,wow gold for
    sale,power leveling,wow
    power level,wow power level,power leveling,wow gold for
    sale,buy cheap wow gold.Indian brides confront gold bears, again

  7. Unknown says:

    Hi,Do you have used LCDs, second hand LCDs, used flat screens and used LCD monitors? Please go here:www.sstar-hk.com(Southern Stars).We are constantly buying re-usable LCD panels and working for LCD recycling.The re-usable panels go through strictly designed process of categorizing, checking, testing, repairing and refurbishing before they are re-used to make remanufactured LCD displays and TV sets.Due to our recent breakthrough in testing and repairing technology of LCD, we can improve the value for your LCD panels.
    website:www.sstar-hk.com[cibfiefciejhchj]

  8. FluidTrade says:

    Can you explain the reason why the \’Pulse\’ is placed outside of the "lock( syncRoot )" block.  It looks like you are trying to prevent some sort of deadlocking, but I can\’t see the conflict.  What would happen if your \’ReleaseReaderLock\’ was structured like this:
     
         lock( syncroot )
         {
              if (–i == 0)
                 wQ.Pulse();
         }
     
     

  9. William says:

    That is correct.  IMO, having IsWriterLockHeld reflect actual lock state is more usable then just knowing if current thread owns the lock.  The current thread "knows" when it ownes the lock or could set local flag as a reminder.  However, a local thread could never know if another thread holds the lock so that is why it is implemented globally.  Your milage may vary depending on use case.

  10. FluidTrade says:

    It appears to me that the \’IsReaderLockHeld\’ and \’IsWriterLockHeld\’ are simplifications of the traditional properties.  These properties are shared by all threads trying to use the ReaderWriter class, whereas the .NET Framework class indicates that the current thread has the locks.  That is, if Thread1 hasn\’t every tried to obtain a reader lock, and Thread2 has a reader lock, when Thread1 looks at the \’IsReaderLockHeld\’ property, they will appear to have a lock.

Comments are closed.