2
jestdotty
32d

my first attempt at promise-like threads without the downside of the incumbent promises library offered in rust, where it spawns a new thread for every promise, appears to be a success

it looks like shit but I did not expect this to work so fast, I feel strange

so now I have a threadpool and i can ask it to take any number of tasks in any order, all of which can spawn more tasks, and it'll get them all done using best available threads rapidly. nice

I do have to synchronize them all at the end but I sorta half figured out how I'm gonna do that but it might not be the most optimal way idk

and there can't be any return data types

so everything has to wrapped in fucking Arcs and Mutexes, both going in and out (or maybe I can fix that? I don't know)

I'm expecting to get locked and shit blowing up. I'm probably being pessimistic

everyone always says threads hard and scary but anytime I touched them in other languages I didn't have issues. maybe threads hard in lower level languages and I'm about to find out these issues? 😖

*expects omens*
monster big, expect scary. things look fine. alertness level paranoid, nothing happens probably

Comments
  • 2
    What I'm missing in most of async libraries is job state tracking. I.E. Dividing the job into several-microsec-long tasks, executing them concurrently [not parallel] and being able to access the job/task state through some handle [promise in your case]. Manually setting the state to CANCELLED would remove the remaining tasks of that job from the scheduler and effectively abort the whole job.

    If a user connects to a server, sends a request, and then disconnects [e.G. F5-refresh], the server continues executing the request, pointlessly wasting resources. Being able to detect such disconnects and terminate the request processing prematurely would be a very nice feature imo.

    This would also allow for more fine-grained execution monitoring and profiling. And you could get away with a single thread for async if you're on a resource-constrained env.
  • 0
    @netikras Games provide a sense of accomplishment through achieving goals, leveling up, and completing missions.
  • 0
    @pigkang just like a job does. Cracking those problems one by one, giving a slight boost of endorphins at the end of every "project".
Add Comment