[DiscordArchive] and how do you control which thread it runs on?
[DiscordArchive] and how do you control which thread it runs on?
Archived author: Foe • Posted: 2024-07-17T21:38:32.699000+00:00
Original source
Okay, so I think I have it working now with a stop request and joinable thread, but I'm really not seeing the point of the stop request other than a nice-to-have?
Like realistically, I'd have to have stop request checks multiple places in the function for it to even have a chance to hit one of the requests. Only having a check at the end of the function is pointless, since it would have completed the function soon anyway and we'd just wait for the thread to be finished with whatever it's doing.
I could understand it if the thread workload was actually relatively large and thus the thread took a long time to finish, but in this case I don't really see the benefit from it
Archived author: jackpoz • Posted: 2024-07-17T22:11:32.022000+00:00
Original source
That's called also a cancellation token
Archived author: Foe • Posted: 2024-07-17T22:11:59.356000+00:00
Original source
Yeah that thing
Archived author: jackpoz • Posted: 2024-07-17T22:12:00.359000+00:00
Original source
You don't really need it, what you need is to let it finish before deleting Eluna stuff
Archived author: jackpoz • Posted: 2024-07-17T22:12:26.897000+00:00
Original source
So just the joinable bit
Archived author: Foe • Posted: 2024-07-17T22:12:29.568000+00:00
Original source
Yep, just pushed an update to the PR, this works fine, set the thread to sleep for 60 seconds and it gracefully shut down and no crashes