Multiple resource serialization for REXX programs - done differently!
The Problem: A VX-REXX program needs to manage a pool of N fundamentally identical resources. Several different threads may need them simultaneously, and one thread may require more than one at a time. Each routine needs to request a resource and be told which one (1-N) it has been allocated, and then needs to relinquish control when it is finished.
The Cereal Solution: Let Cereal manage your semaphores. Just call CerealRequest to ask for a resource; and when you're finished, call CerealRelease with the resource ID. The Cereal functions are thread-safe, and process-separate.
This problem can occur in many places; the most useful to me is the 50 cursors in DB2/2. No two threads should use the same cursor at the same time; when a cursor is needed, any cursor will do; and a single thread may need several cursors.
Full documentation (well, all the docs you get :) can be found in Cereal.TXT in the archive.
Source (in assembly language; needs nasm and S2Macros) is included. Feel free to read it for amusement; but please don't modify it without emailing me, and please, PLEASE, don't distribute modified versions!
File: Cereal.ZIP - current version 1.0.0
Requires: OS/2, REXX
Installation: Unzip
Operation: Call from REXX program.
De-installation: Delete.
Distribution: Emailware.