Guardian Programmer's Guide

Table Of Contents
Contents
Guardian Programmer’s Guide421922-014
xix
26. Synchronizing Processes
26. Synchronizing Processes
How Binary Semaphores Work 26-2
Summary of Guardian Binary Semaphore Procedures 26-4
Using the Binary Semaphore Procedure Calls 26-5
Creating a Binary Semaphore 26-5
Opening a Binary Semaphore 26-6
Locking a Binary Semaphore 26-6
Unlocking a Binary Semaphore 26-7
Testing Ownership of a Binary Semaphore 26-7
Forcing a Lock on a Binary Semaphore 26-8
Closing a Binary Semaphore 26-8
Binary Semaphore Interface Declarations 26-8
Binary Semaphore Example 26-10
Shared Structure 26-10
External Declarations 26-10
Procedure USERESOURCE 26-11
Procedure PRIMARY 26-11
Procedure SECONDARY 26-12
BINSEM_GETSTATS_ and BINSEM_STAT_VERSION_ Example 26-12
27. Fault-Tolerant Programming in C
Overview of Active Backup Programming 27-1
Summary of Active Backup Processing 27-2
What the Programmer Must Do 27-3
Planning Tasks 27-3
Programming Tasks 27-4
C Extensions That Support Active Backup Programming 27-5
Starting the Backup Process 27-5
Opening a File With a Specified Sync Depth 27-6
Retrieving File Open State Information in the Primary Process 27-6
Opening Files in the Backup Process 27-6
Retrieving File State Information in the Primary Process 27-7
Updating File State Information in the Backup Process 27-7
Terminating the Primary and Backup Processes 27-7
Organizing an Active Backup Program 27-8
Primary Process Organization 27-9
Backup Process Organization 27-10