|
Thanks so much!
Real programmers use butterflies
|
|
|
|
|
I like this article. I haven't seen someone use awaitables like this before.
My thoughts:
How the Completed event and OnCompleted callback interact is really not obvious, even from your description of what each individually does. I think the purpose of this setup is so that the continuation passed to OnCompleted will only be executed once the event completes. If Completed fires first, _continuation == _sentinel which triggers the Task.Run(continuation) in OnCompleted . If OnCompleted fires first, _continuation = continuation , so prev = continuation when prev() is executed.
I believe that this entire thing falls apart though if Reset() isn't called after each Completed /OnCompleted trip. If _continuation == continuation from an earlier call, OnCompleted falls through and the current continuation is lost, while Completed executes the previous continuation.
I really want to dive into this when it isn't 2am. I suspect OnCompleted is for completion of pre-await code which is why some of these hoops are needed. Otherwise the ordering of Completed and OnCompleted would be known.
I found two more articles if you wanted to check them out. I only did a cursory overview. It seems like they dive into things in a little more detail but it still wasn't obvious to me how the awaiter methods interact with the overall task architecture.
C# Under the Hood: async/await
Dissecting the async methods in C#
|
|
|
|
|
Oh my thank you! It was murder trying to find information about this. My google-fu just wasn't giving me back much. I was probably asking it the wrong questions.
Real programmers use butterflies
|
|
|
|
|
Found another good one. Also I couldn't sleep because I had to know the answer to this. Kinda funny how OnCompleted is only called if IsCompleted is false It blew my mind when I realized all of the SocketAwaitable code is just for Reset() so you avoid allocating a TaskCompletionSource on each Receive /Send call
Assuming it wasn't a joke, GetResult() isn't called CheckResult() because other awaiters may return a value like a Task<T> 's awaiter. This awaiter implementation doesn't have a return value since that value is returned via the SocketAsyncEventArgs instead.
Thanks for sparking a fun night of learning but now I'm actually off to bed
|
|
|
|
|
Thanks so much for your time and the links. I've been pouring over them/
Real programmers use butterflies
|
|
|
|
|
Just quickly scrolling through it (I actually have to leave for work some five minutes ago ) and came across this:
if (EventArgs.SocketError != SocketError.Success)
throw new SocketException((int)EventArgs.SocketError); Not sure what to think about your try-catch blocks yet.
They are compact, but still have curly braces.
I'll have to meditate on that
|
|
|
|
|
Sander Rossel wrote: They are compact, but still have curly braces.
#CurlyBracesMatter!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
That wasn't even my code! That was Stephen Toub's code!
Real programmers use butterflies
|
|
|
|
|
I am curious as to who is still writing software after turning 65?
Any bits of wisdom you want to share about being a developer over 65, or you younger folks having to work with us older developers? 🙂
|
|
|
|
|
71 and still going strong!
I'm not sure how many cookies it makes to be happy, but so far it's not 27.
JaxCoder.com
|
|
|
|
|
57, having big problem converting conventinal apps to browser apps.
Anyway still relaxed:
Smiles at the new technologies (browser apps). Something fails every week then and when because 'something' in the depths of the web frameworks (be it vue, stencil, react, whatever) has changed.
It does not solve my Problem, but it answers my question
Chemists have exactly one rule: there are only exceptions
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Trying to learn RUST but no motivation becuase don't have a use for it yet.
Relearning WPF, doing a huge app...taking forever.
Up keeping web site with .NET MVC.
Doing several embedded projects.
Just ain't enough time in the day.
I'm not sure how many cookies it makes to be happy, but so far it's not 27.
JaxCoder.com
|
|
|
|
|
That's why I don't use frameworks... (beyond JQuery). After 50yrs of programming, I've built up a library of my own tried and tested bits and bobs.
|
|
|
|
|
61 and still not receiving CP Newsletter since last month!
|
|
|
|
|
Have you checked your spam/junk folder. Sometime that's where they hide.
I checked your account and you should be getting the weekly.
"Time flies like an arrow. Fruit flies like a banana."
|
|
|
|
|
Look at me, hijacking a thread ... nope, no junk, nothing hiding ... the caveat to all this is that sometimes I get notifications of posts to my posts; this post fregzample ... no notification.
It's alright, mind you ... I live here in cp with my browser open so I always know what's going on ...
|
|
|
|
|
Still a couple of years to go, but I plan to still write software after turning 65, despite not having had a proper job for 15 years.
|
|
|
|
|
Getting close to it. While still enjoy programming, I find it would be intellectually dishonest to do it for hire. My memory is still good enough to remember how I was doing it some years ago, but not good enough to keep in play the myriad things you need while programming.
My advice would be more for those in their 20es or 30es: think of your carrier as being in professional sports. No one told me that in programming, like in sports, you peek early and there is no going back. Go for the kill (and fun) while you still can!
Once you passed a certain age, the joy of being in the zone and writing code as if the program writes itself and you are a mere scribe obeying to the logical structures you have just created, all that is gone. You remain with the knowledge and the experience but not the force to do it.
You can move in management or teaching but the satisfaction of being a coder or sometimes what they call a 10x coder, all that is gone.
Just my 0.02$
Mircea
|
|
|
|
|
Still doing it ten years later, but for my own amusement rather than money. I also do some unpaid freelancing for a couple of local charities.
|
|
|
|
|
I know someone who does, and my only wisdom for him is: don't
He got kind of stuck in his old Clipper days and doesn't seem to understand OOP.
Like just enough OOP to make it complicated, but not nearly enough to make it work nice and easy.
I'm now maintaining his code and getting paid so I guess I shouldn't complain too much
I guess the advice would be, keep learning, don't get stuck in old habits.
Come to think of it, I have similar stories for 20-somethings, 30-somethings, 40-somethings and 50-somethings.
I guess age isn't really an issue
|
|
|
|
|
Sander Rossel wrote: Come to think of it, I have similar stories for 20-somethings, 30-somethings, 40-somethings and 50-somethings.
I guess age isn't really an issue
There are plenty of people out there who have 1 year's experience - 25 times over.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Nicely said
|
|
|
|
|
Nearly but not quite there yet. But I'm intrigued as to why you're asking about a specific age? Is it because you're there yourself, or because you perceive 65 to be some sort of milestone? Does your employer treat you differently after 65? Your co-workers? (Why would your co-workers even know your age anyway...?). If they ask, just write down "41". Let 'em assume decimal, if they're that narrow minded. They'll cut you some slack too; if you're 41 and look like that, you deserve it!
|
|
|
|
|
I adjust the base so my age is always 42.
(Where does it say that the base has to be integral?)
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
67 and still enjoy it
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
|
|
|
|