Questions tagged [busy-waiting]

101 questions
3
votes
3 answers

What are the advantages and disadvantages of Busy-waiting and timer interrupts in programming?

A feasible way to achieve a suitable time delay is to use busy-waiting, however what are the advantages and disadvantages of using a busy-waiting or timer interrupts approach programming?
M.Khalaf
  • 75
  • 1
  • 9
3
votes
1 answer

Alternative to time.sleep

INTRO: It is well known that the accuracy of time.sleep is OS and computation load dependent. The accuracy in Windows is very poor. Similarly to /questions/17499837 a method can implement a busy wait using the time.clock method as an alternative to…
WOM
  • 31
  • 1
  • 4
2
votes
1 answer

show user 'processing' animation in python

i just wrote an extremely long script that takes a list of URLs and runs a series of API calls, processes them etc. Unfortunately for majority of the calls, response is empty (to give scale, i get result for ~100 / 4000 urls ) I'm wondering if there…
wickedpanda
  • 51
  • 1
  • 8
2
votes
1 answer

How to avoid busy wait in a single threaded event loop

I'm coding a simple piano roll app that uses the SDL2 bindings for Rust to do its event handling and rendering. I have something very similar to the following code: let fps = 60; let accumulator = 0; // Time in seconds 'running: loop { let t0 =…
Valazo
  • 31
  • 3
2
votes
0 answers

Microsoft Visual Studio 2019 "Server Busy" every time I open a dialog. Devenv.exe is faulting with textservice.dll

Microsoft Visual Studio 2019 shows a "Server Busy" dialog every time I open a dialog. A Procmon search for devenv.exe finds at least 100 NO SUCH FILE entries for the following…
2
votes
1 answer

Why spinlocks can become performance issue in multithreaded programs?

I know what spinlocks are and that they use busy waiting. But why can it become a performance problem in multithreaded programs on a multicore processor? And what can be done about it?
2
votes
1 answer

Is it better to deadlock main thread instead of busy waiting?

I have a main thread that starts multiple deamon threads listening to filesystem events. I need to keep the main thread alive. To do so I can use a while loop, or "deadlock" it. Which is better, performance wise? while True: …
Julien__
  • 1,962
  • 1
  • 15
  • 25
2
votes
0 answers

Custom barrier implementation using condition variables

I am implementing a custom version of pthread_barrier_wait in C. In my first simple implementation i used locks and condition variables. But after some testing and research i found out that when i am using consecutive barrier_wait calls it is not…
mnmbs
  • 353
  • 3
  • 13
2
votes
1 answer

What is the best way to prevent user click anything on the form while processing on background?

I am working on an Youtube Mp3 converter. Mp3 converting takes a few seconds and I want the user not able to click any control on the form. I have done it using Control.Enabled = false for all control but I think this way is not professional and…
Ali Tor
  • 2,772
  • 2
  • 27
  • 58
2
votes
2 answers

Clojure - Wait for changes in files

I have two files, both 1 byte big (containing nothing more than "1" or "0"). Now inside of the main loop of a program written in Clojure, I would want to wait until either of the files have changed before proceeding. This could be done by…
2
votes
1 answer

Why does my tail calling function not pause and flush output?

I have looked through lua-users Sleep Function reference in an effort to find a non-busy waiting solution to the sleep problem and I'm not happy with any of them. Nonetheless I attempted using several to provide a delay at the end of a function…
Stephen
  • 1,607
  • 2
  • 18
  • 40
2
votes
1 answer

How to get the call waiting state of a new incoming call during a phone conversation

I am working with an android application which reads the phone states of incoming phone calls. And i have successfully captured the ringing,off-hook and idle states. But the problem is that i need to get the Call Waiting state of a new incoming…
2
votes
2 answers

Python signal between functions to remove busy waiting

I'm just trying to implement a simple Observer pattern in Python and am running into an issue. This is my code: class Observable: def __init__(self): self.__observers = [] def register_observer(self, observer): …
Jatinshravan
  • 435
  • 3
  • 16
2
votes
3 answers

Busy-waiting alternative

I have a problem with a javascript-Function, where I can't use callback-Functions. The function gets a List of "commands", and iterates over them. It performs one command after another. In order to do that, I have to use a recursive Function with…
maja
  • 17,250
  • 17
  • 82
  • 125
1
vote
1 answer

if there is a infinite loop in a python code, is it harmful or use large amount of resources?

i am trying to make an alarm clock. this uses the time function and check if current time is equal to the alarm time in a while True loop. does it use heavy amount of resources as it check the condition at the maximum frequency it can. is there a…
Lokesh
  • 11
  • 1