|
I'm sorry I brought up Microsoft.
Real programmers use butterflies
|
|
|
|
|
Did you ask for 2047 threads (or the maximum number it supports), or is that the default number that get allocated?
|
|
|
|
|
That's what I get from calling ThreadPool.GetAvailableThreads()
GetMaxThreads() returns a much higher number (i forget it) returns the same number of threads as GetAvailableThreads() when i call it.
Oh crap. No it wasn't. I was calling GetMaxThreads()... it's 6am here, forgive me.
I was right the first time, WTH is wrong with me rn?
Real programmers use butterflies
modified 18-Jul-20 9:09am.
|
|
|
|
|
|
No doubt. I thought it was hot in here.
Real programmers use butterflies
|
|
|
|
|
This might interest you...
Multithreading, Delegates, and Custom Events[^]
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
thanks
Real programmers use butterflies
|
|
|
|
|
I already told you abou that article
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I must have missed it or forgot. Sorry. My memory isn't what it used to be. No offense.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: No offense. Don't worry... I was just bugging you a bit
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Well well. Let's see if we can get a Protector's account closed for trolling!
|
|
|
|
|
You are laughing, but... do you really consider that trolling?
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Mild trolling, sure. Which is what makes it so funny.
|
|
|
|
|
mmm... then I suppose it is a definition thing.
For me trolling is negative, done to harm or to get the other part mad on purpose.
This was more a joke, since I had no bad intentions at all, I do respect the code witch and I am not that kind of user.
Ah... and BTW it is true, I told about that JSOP's article here[^].
Just in case you think the trolling part was to lie about it
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
When you said you were just bugging Honey a bit, I thought you meant that you made the whole thing up! I'd call that mild trolling, to get a reaction, but it shouldn't bother anyone.
|
|
|
|
|
Greg Utas wrote: I thought you meant that you made the whole thing up! Nope, I didn't.
The bugging was the "I told you so", knowing that my comment went undernoticed. If not... I would have got a comment to that.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Yes, I see that now, so it wasn't trolling in any way.
|
|
|
|
|
YOU TERRIBLE TROLL!!!!
Real programmers use butterflies
|
|
|
|
|
I just read it. It's interesting that you managed your own threadpool. The more I try to work with the built in one, the more i want to go back to my own thread pool management like i was doing before. I'll take a look at that SmartThreadPool class to see how it works. I'm interested in that.
I'm using Invoke/BeginInvoke already for my UI updates, but that's not the focus of my project, which relies on message queuing.
The thing I wonder about, is since Task.Run() uses ThreadPool , if I won't have to somehow intercept or wrap it so that it uses mine. I don't know if that's possible.
This was actually easier to do without having to consider Task or ThreadPool . Funny that.
Real programmers use butterflies
|
|
|
|
|
I think TPL manages the thread pool for you.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I figured out some more stuff. Instead of using my own thread pool, I simply changed the way Task items get scheduled, so it will queue items after it exceeds my own quota. That way it still uses the system threadpool but in a way that makes sense. the relevant class is under the Tasks namespace and it's called TaskScheduler . It's kinda neat, but not very well documented.
Real programmers use butterflies
|
|
|
|
|
|
Thanks!
This is how i got around it - i can still use it, but i can throttle the number of concurrent tasks.
Customizing the TaskScheduler: Queue Your Task Work Items to Run When You Want Them To[^]
Seems not so popular, maybe because i ripped a lot of code out of a microsoft example in their docs, but unlike them i explained it (and i modified it)
ETA: The advantage over using a custom thread pool is you can still use tasks with it. To use a custom threadpool like stephens, i'd still need a custom task scheduler similar to what i wrote above to launch tasks on that threadpool
Real programmers use butterflies
|
|
|
|
|
Maybe it's just my NIH proclivity, but following all this just reinforces why I have no time for languages and frameworks that provide higher level threading abstractions. They're usually beyond clueless. Hell, even most of the O/S's are clueless.
|
|
|
|
|
I usually don't care for it either, although using async/await and letting compiler build the necessary state machine to make it work is pretty cool
Real programmers use butterflies
|
|
|
|