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

synchronized and withLock only allow 1 publication #122

Open
GoogleCodeExporter opened this issue May 7, 2015 · 1 comment
Open

synchronized and withLock only allow 1 publication #122

GoogleCodeExporter opened this issue May 7, 2015 · 1 comment
Assignees
Milestone

Comments

@GoogleCodeExporter
Copy link

Procedure to Repeat:
Attempt to synchronize an operation that publishes more than once.


Version and Platform:
SVN r3171 (and after, but I think I am testing at around that build)

Reporter's Comments:
Here is an implementation that avoids the problem. It does require a channel to 
manage the publications (and types would need to be added before it could be 
included in prelude). So both version may be needed so that channels are not 
allocated for every synchronized closure.

def withSemaphore(s, f) =
  val c = Channel()
  repeat(c.get) |
  s.acquire() >> (f() >x> c.put(x) >> stop ; s.release() >> c.close() >> stop) 

Original issue reported on code.google.com by arthur.peters on 23 Apr 2013 at 6:36

@arthurp
Copy link
Member

arthurp commented Jun 5, 2015

I have fixed versions of this that actually also unlock when the expression is killed. However they require Orco. I don't see any reason to try for a fix before Orco becomes main line.

Deferred until after Orco merge (whenever that is).

@arthurp arthurp self-assigned this Jun 5, 2015
@arthurp arthurp added this to the 3.0 milestone Jan 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants