Multi-tasking Considerations When Using Vermont Views

Most Vermont Views functions are not reentrant, because they call standard C library functions that are not reentrant. (The list of non-reentrant standard C library routines differs from compiler to compiler. Check your compiler documentation.)

Because Vermont Views is not reentrant, Vermont Views functions cannot be used from multiple threads. If you attempt to use Vermont Views in an application that has multiple threads or processes within a session, you should ensure that a single thread (within a single process) is responsible for sending all output to the Vermont Views functions. The thread that is using Vermont Views should communicate with the other threads using pipes, queues or shared memory.

According to the IBM C/2 Language Reference Manual, Appendix B, the standard library functions malloc(), calloc() and free() are not reentrant. This means that these functions cannot be used by multiple threads within the same application. The Vermont Views functions mem_get() and mem_free() use calloc() and free(), respectively. A second thread will not be able to use malloc(), calloc(), and free() when the first thread is making Vermont Views calls.

The standard file I/O functions, both low-level and buffered, are not reentrant according to IBM. The Vermont Views functions mf_rd(), mf_wr(), wn_wr(), wn_print(), ms_rd() and ms_wr() use standard file I/O functions. A second thread will NOT be able to use any of the standard file I/O functions when the first thread is making calls to those Vermont Views functions.

According to the OS/2 Technical Reference Manual, you should be aware of potential lockout situations when multiple threads and processes within a session issue Vio calls. Since Vermont Views uses Vio calls to perform its video output, these same comments apply to Vermont Views functions.


Home Contents Previous Next