-
Notifications
You must be signed in to change notification settings - Fork 58
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
Provide a way to access a SharedQueue with timeout after being waiting by some time #1008
Comments
I don't think this implementation is suitable for the base system for a number of reasons, e.g. starting two processes is very heavyweight, Process>>kill should never be used in normal code as it doesn't clean up the Process properly, plus the nil check on the process variable highlights a possible race condition. |
I was aware about the things you mention here. I moved it to BlockClosure so now it is less dangerous in the sense of inadvertently using it in SharedQueue an also it can be used in other scenarios. In any case I understand that this implementation is not correct for the base system. Still a race condition is theoretically possible in
I could also try your idea later |
Is your feature request related to a problem? Please describe.
I need to acquire a new connection from my own implementation of a connection pool that uses a SharedQueue. I'd like to be able to specify a maximum time to wait to get a new element from the pool in order to alert the user about some time and not wait forever.
Describe the solution you'd like
I was thinking in a new method
SharedQueue>>nextWait:
and I've also implemented a working example with some snippet I've found in Dolphin's newsgroup in a post from Esteban Maringolo.This is returning nil on timeout. It would be useful to raise a timeout exception. If you think that this is ok to add into the base I could provide a PR with the corresponding tests.
I know that maybe there is a better solution for this as I'm aware of
Semaphore>>wait:ret:
commentsThe text was updated successfully, but these errors were encountered: