Menu

#297 add MF Run-unit Handling Routines

GC 3.0
accepted
None
5 - default
2024-05-05
2018-03-19
No

Assigned to Ron as the most "complex" (part is a wrapper around the internal functions for fork and exit that he added) + an internal file access. @Ron: Please opt-out if you don't want to add it, but in general I think it is a low-hanging fruit.
Thank you!

The referenced routines and documentation can be found in https://www.microfocus.com/documentation/visual-cobol/vc90/DevHub/HRCLRHCALL0Z.html

CBL_ABORT_RUN_UNIT would be currently only an internal STOP RUN with a comment in the C parts to re-investigate as soon as we support threads.
CBL_EXEC_RUN_UNIT is a wrapper around cob_sys_fork and cob_sys_waitpid.

CBL_YIELD_RUN_UNIT may be implemented as an internal sleep with reasonable small time (something between 0.1 and 1 seconds - I tend to 0.5 or 0.1).

CBL_GET_SHMEM_PTR and CBL_PUT_SHMEM_PTR would use shmget() and friends (doing a simple hash on the name to create the numeric key value) if that is available, otherwise can be implemented by internal files with the requested name as cob_gettmpdir ()+"SHMEM_ + name.
For Win32 someone potentially comes later that uses GetFileMapping() and friends to implement it there...

Discussion

  • Alain Reymond

    Alain Reymond - 2023-12-30

    Hello,
    Is there a plan to include the 'CBL_EXEC_RUN_UNIT' to create synchronous or asynchronous run unit ?

    I wish the project a fantastic 2024!

    Alain

     
  • Simon Sobisch

    Simon Sobisch - 2024-05-05
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,15 +1,12 @@
     Assigned to Ron as the most "complex" (part is a wrapper around the internal functions for fork and exit that he added) + an internal file access. @Ron: Please opt-out if you don't want to add it, but in general I think it is a low-hanging fruit.
     Thank you!
    
    -The refrenced routines and documentation can be found in https://supportline.microfocus.com/Documentation/books/sx50/rhcall0z.htm
    +The referenced routines and documentation can be found in https://www.microfocus.com/documentation/visual-cobol/vc90/DevHub/HRCLRHCALL0Z.html
    
    -[`CBL_ABORT_RUN_UNIT`][1] would be currently only an internal `STOP RUN` with a comment in the C parts to re-investigate as soon as we support threads.
    -[`CBL_EXEC_RUN_UNIT`][2] is a wrapper around `cob_sys_fork` and  `cob_sys_waitpid`.
    -[`CBL_GET_SHMEM_PTR`][3] and [`CBL_PUT_SHMEM_PTR`][4] may be easiest implemented by internal files in  with the requested name as `cob_gettmpdir ()`+`"SHMEM_` + name.
    -[`CBL_YIELD_RUN_UNIT `][5] may be implemented as an internal sleep with reasonable small time (something between 0.1 and 1 seconds - I tend to 0.5 or 0.1).
    +`CBL_ABORT_RUN_UNIT` would be currently only an internal `STOP RUN` with a comment in the C parts to re-investigate as soon as we support threads.
    +`CBL_EXEC_RUN_UNIT` is a wrapper around `cob_sys_fork` and  `cob_sys_waitpid`.
    
    -[1]:https://supportline.microfocus.com/Documentation/books/sx50/rhcall19.htm
    -[2]:https://supportline.microfocus.com/Documentation/books/sx50/rhcall21.htm
    -[3]:https://supportline.microfocus.com/Documentation/books/sx50/rhcall2o.htm
    -[4]:https://supportline.microfocus.com/Documentation/books/sx50/rhcall3j.htm
    -[5]:https://supportline.microfocus.com/Documentation/books/sx50/rhcall5i.htm
    +`CBL_YIELD_RUN_UNIT` may be implemented as an internal sleep with reasonable small time (something between 0.1 and 1 seconds - I tend to 0.5 or 0.1).
    +
    +`CBL_GET_SHMEM_PTR` and `CBL_PUT_SHMEM_PTR` would use [`shmget()`](https://linux.die.net/man/2/shmget) and friends (doing a simple hash on the name to create the numeric key value) if that is available, otherwise can be implemented by internal files with the requested name as `cob_gettmpdir ()`+`"SHMEM_` + name.
    +For Win32 someone potentially comes later that uses [`GetFileMapping()`](https://learn.microsoft.com/en-us/windows/win32/memory/creating-named-shared-memory) and friends to implement it there...
    
     

Log in to post a comment.