Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not block Agent#value when updating && other improvements #65

Merged
merged 5 commits into from
May 7, 2014

Conversation

pitr-ch
Copy link
Member

@pitr-ch pitr-ch commented May 5, 2014

see https://github.com/jdantonio/concurrent-ruby/blob/master/lib/concurrent/agent.rb#L163

I'll submit PR later. What is the schedule for 0.6 release? how much time do I have If I would like to get this fix in?

  • do not block reading when updating
  • does not allow to execute two updates at the same time

Other:

@mighe
Copy link
Contributor

mighe commented May 5, 2014

Just for curiosity, could you provide an example/use case for this problem?
When I saw that method, I left the block call inside the mutex thinking that we are already passing the current value to the block, so there is no reason to call any other synchronized method of the object.
Clearly I was wrong 😊 and it should be fixed

No schedule for 0.6, so you can go and fix it.

@jdantonio
Copy link
Member

I was supposed to create a pre-release build last Friday but I haven't yet. I had planned to create actor pools for that pre-release but I've been very busy lately and haven't had as much time for the gem as I would have liked.

@pitr-ch Please take whatever time you need to make the update. We greatly appreciate your help. Also, I was not aware of your Actress until just now but it looks like you and I share many of the same ideas about actors. Would you be interested in collaborating?

@jdantonio
Copy link
Member

@pitr-ch I just took a look at your Algebrick library, too. I've also experimented with Erlang-inspired pattern matching in Ruby. You and I definitely share many of the same influences and ideas.

@pitr-ch
Copy link
Member Author

pitr-ch commented May 5, 2014

@jdantonio Yep I would be interested in collaborating :) Thanks for the link I'll look at the functional-ruby. Converted this issue to PR. I've opened #66 to track the Actor pool-ification.

ensure only one update is running
@pitr-ch
Copy link
Member Author

pitr-ch commented May 6, 2014

@mighe use-case: I don't have a concrete one, but I would imagine that when an app would be using agents heavily, it would cause delays and even deadlocks (e.g. two agents reading each other). This is also one a fundamental features of clojure that the agent can be read at any time without coordination.

@jdantonio could you look at/restart travis please?
update: restarted by amend

@pitr-ch pitr-ch mentioned this pull request May 7, 2014
9 tasks
@pitr-ch pitr-ch changed the title Calls to deref. are blocking when agent is updating its value Do not block Agent#value when updating && other improvements May 7, 2014
@jdantonio jdantonio merged commit 026641c into ruby-concurrency:master May 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in the library or documentation. enhancement Adding features, adding tests, improving documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants