Question

Race conditions when using signals

Is it possible for race conditions to appear when using signals? For example, let's say I have a process A that creates an object. There's also a process B that gets called when object of this type is created and it sets the object status to some value. In its next step process A checks this status.

Will all those actions always appear in the same order or is it possible that sometimes process B will change the object status before the check in the process A and sometimes it will do that after the check?

Like 0

Like

2 comments

Dear Carlos,

Usually, task like those are solved with the help of timers and/or subprocesses. You can add wait timer after process A creating an object and after process B modifies it so the processes will have time to complete. You can aslo test the time it takes for both process to complete to adjust timers accordingly. If the processes check/modify the same object but they are not connected it is completely possible that process A might check the status before it was changed by B.

Ok, thank you for the information.

Show all comments