| | | 1 | | namespace Morpho25.Settings |
| | | 2 | | { |
| | | 3 | | /// <summary> |
| | | 4 | | /// TThread class. |
| | | 5 | | /// </summary> |
| | | 6 | | public class TThread |
| | | 7 | | { |
| | | 8 | | private uint _tThreadpriority; |
| | | 9 | | |
| | | 10 | | /// <summary> |
| | | 11 | | /// Is active? |
| | | 12 | | /// </summary> |
| | 4 | 13 | | public Active UseTreading { get; set; } |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Thread priority on Windows |
| | | 17 | | /// </summary> |
| | | 18 | | public uint TThreadpriority |
| | | 19 | | { |
| | 12 | 20 | | get { return _tThreadpriority; } |
| | | 21 | | set |
| | 4 | 22 | | { |
| | 4 | 23 | | if (value > 31) |
| | 1 | 24 | | value = 31; |
| | | 25 | | |
| | 4 | 26 | | _tThreadpriority = value; |
| | 4 | 27 | | } |
| | | 28 | | } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Create a new tthread object. |
| | | 32 | | /// </summary> |
| | | 33 | | /// <param name="useTreading">Active.</param> |
| | 2 | 34 | | public TThread() |
| | 2 | 35 | | { |
| | 2 | 36 | | UseTreading = Active.NO; |
| | 2 | 37 | | TThreadpriority = 4; |
| | 2 | 38 | | } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Title of the XML section |
| | | 42 | | /// </summary> |
| | 1 | 43 | | public string Title => "TThread"; |
| | | 44 | | |
| | | 45 | | /// <summary> |
| | | 46 | | /// Values of the XML section |
| | | 47 | | /// </summary> |
| | 1 | 48 | | public string[] Values => new[] { |
| | 1 | 49 | | ((int) UseTreading).ToString(), |
| | 1 | 50 | | TThreadpriority.ToString() |
| | 1 | 51 | | }; |
| | | 52 | | |
| | | 53 | | /// <summary> |
| | | 54 | | /// Tags of the XML section |
| | | 55 | | /// </summary> |
| | 1 | 56 | | public string[] Tags => new[] { |
| | 1 | 57 | | "UseTThread_CallMain", |
| | 1 | 58 | | "TThreadPRIO", |
| | 1 | 59 | | }; |
| | | 60 | | |
| | | 61 | | /// <summary> |
| | | 62 | | /// String representation of tthread object. |
| | | 63 | | /// </summary> |
| | | 64 | | /// <returns>String representation.</returns> |
| | 0 | 65 | | public override string ToString() => $"Config::Treading {UseTreading}"; |
| | | 66 | | } |
| | | 67 | | |
| | | 68 | | } |