Highlighted
New Member.
1033 views

Locking Threads

I would like to place a thread lock around the code below but I'm not sure what the syntax would be in Visual COBOL. Can you help me with the syntax?

           IF WS-COMM-FROM-PROGRAM > SPACES
             ??Lock
             PERFORM VARYING WS-PREV-PROG-ENTRY
               FROM 1 BY 1 UNTIL WS-PREV-PROG-ENTRY > NAV-MAX-ENTRIES
                  IF NAV-PROGRAM-ID (WS-PREV-PROG-ENTRY) =
                     WS-COMM-FROM-PROGRAM
                     MOVE SPACES TO WS-COMM-FROM-PROGRAM
                     EXIT PERFORM
                  END-IF
             END-PERFORM
             ??End Lock        
           END-IF.

0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: Locking Threads

You could use a mutex for this. See:-

documentation.microfocus.com/.../index.jsp

for an example.

Regards

David

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Locking Threads

If this is managed code you could also use the SYNC/END-SYNC statement.

Please see the documentation for an example here:

Thanks

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.