-
Notifications
You must be signed in to change notification settings - Fork 16
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
Export getThreadId from GHC.Conc.Sync #117
Comments
Is that a good name? I was assuming a function of that name to have type
|
I agree with @nomeata . |
Sure, I have no strong opinion about the name. I have updated the proposal with this suggestion. |
The function should have a type Also, for the risk of unnecessary bikeshedding, I had to import this in one in one of my projects and used the name weakThreadId because it kinda is - it's a unique thread identifier, but holding onto it (unlike holding onto ThreadId# itself) won't prevent the thread from getting garbage collected if appropriate. |
Shouldn't that be Word64 then? |
Yes. Which makes foreign import typedef StgWord64 StgThreadID;
StgThreadID rts_getThreadId (StgPtr tso); So it seems that all code on Hackage importing |
@bgamari this is a wrong ticket, I think. |
Yes, a good point. I will update the proposal.
Fixed. |
On @phadej's request, I have further updated the proposal such that However, this now introduces the awkward fact that
|
To be fair, all of these are a bit confusing. It's somewhat unfortunate since at this point you already have the |
Please can we have a resolution on this @haskell/core-language-committee ? |
@mpickering #117 (comment) looks to me like an invitation for discussion, not the final proposal for a vote. |
@Bodigrim, to my mind the proposal is done and I think the proposed naming is acceptable. I presented the other alternatives to spur discussion but given that there aren't any strong opinions on the matter I think it would be fine to put this to a vote. |
CLC is currently on pause anyway until new members are elected, which will hopefully happen somewhere next week. |
Sorry for bringing more unwelcome news, but I was reading
Which are not unlike this issue. OTOH, these are good news also, as it seems to be the only entries on the base-4.18.0.0 changelog without CLC Proposal, all others have them, except
|
Thanks for digging it out, it is not unwelcome at all. We should have done a better job with regards to communication and monitoring last year. Reverting the changes and ramming through a proposal in a week or so left before 9.6 RC will be a farce, not a public scrutiny. Given that
Back to the topic, |
The proposal is to export foreign import ccall unsafe "rts_getThreadId" getThreadId :: ThreadId# -> CULLong Strictly speaking, Now, the hardest question of all: naming. It might be suboptimal for a public function of type
Dear CLC members, let's help the proposer to choose a name. This is not a vote, just non-binding opinions. Obviously, if you are against exporting this function under any name, please say so as well. @chshersh @mixphix @angerman @tomjaguarpaw @parsonsmatt @hasufell. |
This way we don't need to rename in case the API breaks with a different type (e.g. another newtype over Word64 or god knows what). |
I like @hasufell's suggestion. I find it's the clearest. ToInt feels certainly wrong. Especially as it does not align with the signature. |
I agree on |
@bgamari are you happy with |
@bgamari could you please update the proposal? |
I have updated the proposal to reflect the |
One remaining question is whether |
To a certain extent Unless someone feels strongly that re-exporting |
An immediate vote is fine with me. |
Dear CLC members, any non-binding opinions on this? |
I'm happy with the name of the function, its type and it being exported from However, the documentation for |
Dear CLC members, let's vote on the proposal to add @chshersh @tomjaguarpaw @hasufell @angerman @parsonsmatt @mixphix +1 from me. |
+1 |
3 similar comments
+1 |
+1 |
+1 |
Thanks all, 5 votes out of 7 are enough to approve. |
Currently
GHC.Conc.Sync.ThreadId
is nearly entirely opaque, supporting onlyEq
,Ord
, andShow
. Such a restrictive interface is quite limiting and precludes the user providing instances likeHashable
without relying on GHC's internals (e.g. see https://hackage-search.serokell.io/?q=rts_getThreadId). Moreover, this is quite silly as GHC already associates a unique integer identifier with each thread.I propose exporting the following from
GHC.Conc.Sync
:This will expose the thread identifier to the user.
See also: GHC #22700
The text was updated successfully, but these errors were encountered: