Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title How to guarantee an atomic operation in QNX4
Ref. No. QNX.000009413
Category(ies) Development
Issue Programming in Watcom 10.6 C and QNX 4.24, I have some variables that will be shared by other processes and need to guarantee that only one process can use the variable at a time.

What can I do to insure that an operation is atomic under QNX 4.24?
Solution If your processes are going to read/write to your variables at interrupt time, there is pretty much only one method: enable()/disable() pairs.

If accesses are to be done at process time, then
a common method is to protect the critical access with semaphores -- look at sem_init(), sem_wait(), and sem_post() in the manual.