-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
add navailable()/capacity(RemoteRef{Channel}) #12781
base: master
Are you sure you want to change the base?
Conversation
anyone with direct experience with RemoteRef / RemoteValue want to chime in here? otherwise, this sounds reasonable to me. |
@@ -102,6 +102,8 @@ end | |||
|
|||
eltype{T}(::Type{Channel{T}}) = T | |||
|
|||
capacity(c::Channel) = c.sz_max |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be length(Channel)
perhaps? capacity
is not currently defined anywhere in Base.
will also need to add docs and tests for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also n_avail()
(so far used in the context of Channel
only). To me length()
is rather a synonym of n_avail()
. capacity()
could be potentially reused in other places to return what sizehint!()
has set. But I would be glad to change it into anything core Julia developers decide.
It used to be defined as The change looks OK, but the names will go through a round of bikeshedding I guess. |
7e846e3
to
b79fa22
Compare
@amitmurthy You should probably merge if you're ok with it. |
If we're going to add I think the same is probably true for |
IMHO, as capacity and current occupancy have impact on the user task scheduling (via |
I'm just saying that |
I have left exporting out of the PR scope to increase the chances of merging. ;) |
:) I guessed that, but that's exactly what I'm concerned about. The On Thu, Aug 27, 2015 at 6:18 PM, Alexey Stukalov notifications@github.com
|
Actually, for refining the API it would be nice to have some reference implementation of, say, master/slave model. It would also help the users a lot. |
We can rename
|
Just some thoughts: |
Don't have an alternative for "capacity" given your observations.... |
+1 for |
|
I think there is an unstated consensus on not using underscores in exported names. I don't know the rationale for the same, though personally I am OK with it. |
51217c7
to
6c0a3b4
Compare
It looked like Actually, since It would be nice to have it in 0.4. |
6c0a3b4
to
39ab92f
Compare
The |
In my case workers are constantly sending elements to the channel. I use |
This certainly isn't the only place where the API occurs, so maybe it's fine, but I'd like to investigate removing it and replacing it with something better in the future. |
|
Needs rebase and adding to docs/src, but still seems reasonable to me. |
bump? This is one of the oldest open PRs now |
Make current number of elements in the
Channel
and its capacity available viaRemoteRef
.Should be important for dynamically balancing the channel's usage in some applications.