Results 1 to 3 of 3
  1. #1
    lovelycse is offline Member
    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    Default TASLock in concurrency

    public class TASLock implements Lock {
    AtomicBoolean state = new AtomicBoolean(false);
    public void lock() {
    while (state.getAndSet(true)) {}
    }
    public void unlock() {
    state.set(false);
    }
    }

    hello this is the code written in java..i am not fiding the way how to implement this...its a lock functioning on crictical section.
    kindly help
    thank you

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default Re: TASLock in concurrency

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default Re: TASLock in concurrency

    Code copied from any one of about 60 sources on the net.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Java in Concurrency
    By bernerd in forum Advanced Java
    Replies: 0
    Last Post: 10-03-2011, 08:20 AM
  2. A set of questions on concurrency.
    By KutaBeach in forum Threads and Synchronization
    Replies: 1
    Last Post: 07-22-2011, 04:21 PM
  3. Practicing Concurrency
    By sunde887 in forum New To Java
    Replies: 1
    Last Post: 06-21-2011, 03:27 AM
  4. GUI Concurrency Problems
    By jkhamler in forum Threads and Synchronization
    Replies: 18
    Last Post: 01-20-2010, 03:40 PM
  5. concurrency question
    By diggitydoggz in forum New To Java
    Replies: 4
    Last Post: 01-17-2009, 03:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •