4

I don't think I like programming threads

Comments
  • 1
    Do you have a valid use case for them anyway?
  • 4
    You can get the wrong answer even faster!
  • 1
    @retoor I tried to make my threadpool make more threads if it's overtaxed and end threads if a bunch of them are idle but the numbers make my poor addled brain confused so what happened is during my tests I was launching thousands of threads and I don't think I even noticed my computer having issues with it. so technically I don't

    but I'm already here

    I mean I do need threads but I could've just started threads and stopped them, without needing a pool. which there is a library in rust that offers a promise-like API that does that. and I was like naw sounds dumb and my threads are re-usable
  • 1
    I forget now if I figured out my tricky problem. ended up taking a break because I hate not being able to think through something

    threadpool > send in jobs > jobs are functions and the functions look for an unused socket (threadpool knows nothing of this). problem is if there's no free sockets the thread technically is still running checking for a socket over and over again, so the threadpool will think we need more threads but all the threads will be looping waiting for a free socket

    so I gotta figure that out somehow

    otherwise, priority queue and scopes I think are working. didn't test the priority queue too heavily but it's not locking which an earlier version before this rewrite was

    I also made the threadpool global, which makes it easy for a lazy person like me that overengineers to be lazy in a mythical future scenario
  • 1
    oh yeah my plan was to rewrite my swarm implementation to use the new threapdool and to just test it with live data

    so that I actually have sockets selection to play with instead of sitting here trying to figure it out in my head when my head won't go because I got the brain damage, wah wah wah

    either case i'd have to rewrite the swarm implementation to switch over to the new system
  • 0
    @jestdotty I use select system call instead of threads for sockets. You can combine it - if a socket became readable, start thread to communicate, or directly after connect
  • 0
    isn't this what you're after?

    https://cisco.github.io/ChezScheme/...

    sorry for being repetitive x.x I can't help myself
Add Comment