Coder Social home page Coder Social logo

Comments (5)

AdorablePotato avatar AdorablePotato commented on July 26, 2024

At the moment, there is no other way. Would a fix of issue #2 help you?

There would still be the problem with providing a timeout value in the with statement. I don't want to change the behavior of the acquire method for backward compatibility, but I could implement the __call__ method to allow you doing this:

with self.lock(timeout = 10):

I'm open for any ideas.

from filelock.

AdorablePotato avatar AdorablePotato commented on July 26, 2024

I noticed now, that I broke the API with the reference counter, since your example worked before.

from filelock.

benprew avatar benprew commented on July 26, 2024

I think the __call__ method idea sounds good, my python skills aren't great, so you probably have better ideas than I do :)

from filelock.

AdorablePotato avatar AdorablePotato commented on July 26, 2024

I fixed this issue in the dev branch. You can now use the acquire() method also in the with statement without side effects. So this works now:

with lock.acquire(timeout = 10):
  assert lock.is_locked
  with lock.acquire(timeout = 10):
    assert lock.is_locked
assert (not lock.is_locked)

I will upload the new version in the next days.

from filelock.

benprew avatar benprew commented on July 26, 2024

Awesome, thanks for making the change so quickly!

On Thu, May 28, 2015 at 3:54 PM Benedikt Schmitt [email protected]
wrote:

I fixed this issue in the dev branch. You can no use the acquire()
method also in the with statement without side effects. So this works now:

with lock.acquire(timeout = 10):
assert lock.is_locked
with lock.acquire(timeout = 10):
assert lock.is_lockedassert (not lock.is_locked)

I will upload the new version in the next days.


Reply to this email directly or view it on GitHub
#3 (comment)
.

from filelock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.