Compilation of multithreaded systems

Settings

 

Compilation

Just launch the compilation: the ISE compiler will generate and link the multithreaded executable.

 

External C files

The C files that you link with a multithreaded Eiffel application must be compiled in multithreaded mode. In addition, you should follow some basic guidelines, which you can find in any documentation on threads. Here are the main requirements:

Note: if you use the libraries Net and MEL in multithreaded mode, you should use libmtnet.a and libmtmel.a. When using MEL, you have to be aware that Motif 1.2 is not threaded-safe (i.e not reentrant). Motif 2.x is threaded-safe.

 

Thread Safe Eiffel libraries

Most ISE Eiffel libraries are not thread safe. This means that even though you can use them in a multithreaded environment, you will need to add the necessary protection to ensure that objects are accessed only by one thread at a time.

Most of the issues is related to the use of EiffelBase containers which have been designed at a time where threads where not present. In the future we will certainly provide a version of EiffelBase which will be designed to be thread safe, in the meantime, you have to use basic protection mechanism such a mutexes to guarantee a safe execution of your programs.

Here is a summary of what you need to include in your project settings when using our libraries:

- EiffelBase: not thread safe, no externals required

- WEL: partly thread safe regarding creation of graphical objects that belongs to two different threads, but since it relies on EiffelBase, be aware of what has been said. Other libraries have the same dependency on EiffelBase and this warning will not be repeated. Change the library wel.lib by mtwel.lib

- MEL: you have to be aware that Motif 1.2 is not thread safe and that Motif 2.x is. Therefore you can use MEL in a multithreaded program only if you have Motif 2.x. In this case, you need to include libmtmel.a instead of libmel.a

- EiffelNet: thread safe with above limitation on EiffelBase. Change the library net.lib by mtnet.lib on Windows. For unix based systems, change libnet.a by libmtnet.a

- COM: not thread safe. Change com.lib and com_runtime.lib into mtcom.lib and mtcom_runtime.lib.