I'm working on a semi-reentrant assembler routine. Its fully reentrant with the exception of a small amount of working storage that they share (one of the parameters).
I happen to know there will be at most one other thread running this same csect. So that might help simplify things a bit.
I'm looking for a way to establish mutual exclusion with my code. Its to protect a single MVC instruction from rare conditions between the two threads. Something as simple as a semaphore I can implement would do the trick. For the life of me I can't even find which instructions are atomic (if any, I know several that are NOT.)
I wondered if anyone has done this sort of thing before? I appreciate any suggestions. Thanks.
Preventing simultaneous use of the same copy when you have more than one task in the job step requires more effort on your part. You must still be sure that the logic of the program for each task does not require a second use of the same load module before completion of the first use. You must also be sure that no more than one task requires the use of the same copy of the load module at one time. You can use the ENQ macro for this purpose. Properly used, the ENQ macro prevents the use of a serially reusable resource, in this case a load module, by more than one task at a time. For information on the ENQ macro, see Chapter 6, "Resource control" in topic 6.0 You can also use a conditional ENQ macro to check for simultaneous use of a serially reusable resource within one task.