#Non-interruptible thread sleeping
17 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @abstract barn! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
I guess you can check whether you slept long enough and if not, sleep what's left
Couldn't you simply opt out of interrupting?
I could opt out of interrupting but that would complicate things a lot
and the point isn't to sleep for some particular time period
the point is to sleep for any time at all because otherwise my cpu usage goes to 50%
Who smells X Y problem?
That could very well be the case but I would rather hold off on rewriting a bunch of stuff until after I find out whether it's at all possible
although it sounds like it probably isn't
sniff
yeah, definitely
Please be more specific
What exactly are you trying to achieve?
Well I am making something like a video player and you know these cool sliders the video players have where you drag them and go around the video?
well I need that skipping around the video to be as interactive as possible so I need to process the most recent slider move but when the slider handle is just taken and dragged across that equals a bunch of these skip requests and the way I deal with this is sleep the thread that handles the skipping for a bit at the beginning of the method and if another skip request comes I interrupt that sleeping and start processing the new one
the problem is when the slider is getting dragged across the interrupt requests come to fast and the thread is basically active 100% of the time