answersLogoWhite

0

You can only protect a function from interruption by another thread in the same process -- you cannot prevent the operating system from interrupting your program, nor threads in a separate process. To prevent interruption by another thread, use a mutex. The thread that holds the mutex blocks all other threads from holding that same mutex -- they must wait for it to be released by the holder. However, mutexes should only be used when two or more threads need to share information that must be written to by one or more of the threads. They cannot all write simultaneously and you cannot read information that is currently being written. So each thread must obtain the mutex immediately before performing a read or write, and must release it when the read or write is complete. In this way, only one thread has access to the information at any given moment, and all other threads are blocked. This does not prevent interruption, however. You can reduce the chances of interruption simply by raising your thread's priority. Level 0 is the highest priority but is reserved for the operating system, but there are 31 levels available (1 to 31). Use this sparingly and only when absolutely required.

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

How can I protecting a dedicated function in Visual C plus plus from interruption by the system - I have tried threads with critical sections and they are still interrupted?

Just because you protect threads with critical sections does not mean the threads cannot be interrupted by the system. What it does mean is that, if the threads are correctly protected with the same critical section, the threads cannot interrupt each other. If this is not true, then your code is defective. Make sure the thread blocks when the critical section cannot be entered, and that it properly releases the critical section when it is done.


What is a trigger function in visual basics?

hifoew;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


What are the visual receptors that function in low light?

Rods


What is a function procedure in Visual Basic?

A function is essentially a subroutine that is ment to be used by other subroutines.


How do you setup visual voice mail on mtn network rsa for iPhone?

MTN in RSA does not have the Visual Viocemail function.


In visual basics what is information that is being passed to a function?

argument


What function in Visual Basic will return a date from a computer?

(it used to be) DATE$


What is the function of midbraine?

whats the function of the spinalthe midbrain is relay center for audio and visual information. The midbrain is also responsible for movement of the head.Controls many functions such as visual and auditory systems, as well as eye movements.


What is the function of the corpus quadrigemina in the sheep brain?

Relay for visual and auditory reflexes


What is rounding in Visual Basic?

Rounding in Visual Basic is the method of rounding an integer up, or flooring an integer, which is rounding down. To round up, you use the System.Math.Round function. To round down, or floor, you use the System.Math.Floor function.


What is the unreflective layer of the eye?

The unreflective layer of the eye refers to the retinal pigment epithelium (RPE), which is a layer of cells located between the retina and the choroid. This layer is crucial for supporting photoreceptors by absorbing excess light, preventing scattering, and recycling visual pigments. Additionally, it plays a role in maintaining the health of retinal cells and protecting against oxidative stress. The RPE is essential for optimal visual function.


What is the function of visual c plus plus switch condition?

The switch / case statement.