Modifies the management modes of threads. The available management modes are as follows:
- the automatic or manual management of the critical sections on the procedures and on the methods.
- the distribution of the execution of the threads on the different processors or on the different cores of the computer.
The automatic critical sections prevent the execution of a procedure or method by several threads simultaneously. The automatic critical sections are enabled by default.
Syntax
Modifying the management modes of threads Hide the details
<Result> = ThreadMode(<New management modes>)
<Result>: Integer
Management modes of threads before the modification, combination of the constants below.
<New management modes>: Constant or combination of constants
Mode for managing the critical sections of procedures and methods: | |
threadAuto | Automatic management of critical sections: each procedure or method can be run by a single thread at a time. |
threadCriticalSection (Default value) | Manual management of critical sections: each procedure or method can be run by several threads simultaneously. In this case, you must protect the accesses to the resources shared between the different threads by critical sections. |
Distribution of the threads on the processors or on the cores: | |
threadMonoProcessor | All the threads of the application are run on a single processor or on a single core. |
threadMultiProcessor (Default value) | The threads are automatically distributed among the different processors or among the different cores. |
Retrieving the management modes of threads Hide the details
<Result> = ThreadMode()
<Result>: Integer constant (or combination of constants)
Current management modes of threads: Mode for managing the critical sections of procedures and methods:
| |
threadAuto | Automatic management of critical sections: each procedure or method can be run by a single thread at a time. |
threadCriticalSection (Default value) | Manual management of critical sections: each procedure or method can be run by several threads simultaneously. In this case, you must protect the accesses to the resources shared between the different threads by critical sections. |
Distribution of the threads on the processors or on the cores: | |
threadMonoProcessor | All the threads of the application are run on a single processor or on a single core. |
threadMultiProcessor (Default value) | The threads are automatically distributed among the different processors or among the different cores. |
Remarks
Managing the multi-processors
This option should only be used in some advanced cases.
On a single-core single-processor computer, the threadMonoProcessor and threadMultiProcessor constants have no influence.
On a multi-core or multi-processor computer:
- The threadMonoProcessor mode forces the application to use a single processor or a single core.
- The threadMultiProcessor mode is used to restore the standard operating mode: in this case, the system automatically manage the distribution of the threads on the processors or on the cores.