Dictionary Class

Top  Previous  Next

 

The new Clarion threading model dictates that the existing File and Relation Managers use threaded objects (i.e. a new instance on every thread).

 

One of the effects of this is that the traditional ABC code that initializes both File and Relation Managers (contained in the DctInit generated procedure) now has to be executed whenever a new thread is started. Likewise, the Managers’ kill code (traditionally contained in DctKill) must be called whenever a thread is terminated.

 

To facilitate this, a small globally defined class called Dictionary will be generated into every ABC template based application that does not have its global data defined external to the application. (i.e. the File and Relation managers compiled locally). The Dictionary object contains only construct and destruct methods but, more important, it is a threaded object.

 

Example:

 

Dictionary  CLASS,THREAD

Construct    PROCEDURE

Destruct     PROCEDURE

           END

 

Dictionary.Construct PROCEDURE

 CODE

 DctInit()

 

Dictionary.Destruct PROCEDURE

 CODE

 DctKill()

 

 

This means that the Construct method will be called whenever a new thread comes into existence and the Destruct method will be called whenever a thread is terminated. The constructor calls DctInit and the destructor calls DctKill. Therefore, DctInit is called whenever a thread is started and DctKill is now called whenever a thread is terminated; thus ensuring that threaded File and Relation managers are created and destroyed correctly.