PageRenderTime 29ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/AutoHotkey.docset/Contents/Resources/Documents/commands/_MaxThreadsBuffer.htm

https://gitlab.com/ahkscript/Autohotkey.docset
HTML | 40 lines | 33 code | 7 blank | 0 comment | 0 complexity | cd5d8a703f7af4ceac9f2147a80feddf MD5 | raw file
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>#MaxThreadsBuffer</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <link href="../static/theme.css" rel="stylesheet" type="text/css" />
  8. <script src="../static/content.js" type="text/javascript"></script>
  9. </head>
  10. <body>
  11. <h1>#MaxThreadsBuffer</h1>
  12. <p>Causes some or all <a href="../Hotkeys.htm">hotkeys</a> to buffer rather than ignore keypresses when their <a href="_MaxThreadsPerHotkey.htm">#MaxThreadsPerHotkey</a> limit has been reached.</p>
  13. <pre class="Syntax">#MaxThreadsBuffer On|Off</pre>
  14. <h3>Parameters</h3>
  15. <dl>
  16. <dt>On|Off</dt>
  17. <dd><p><strong>On</strong>: All hotkey subroutines between here and the next <code>#MaxThreadsBuffer ON</code> directive will buffer rather than ignore presses of their hotkeys whenever their subroutines are at their <a href="_MaxThreadsPerHotkey.htm">#MaxThreadsPerHotkey</a> limit.</p>
  18. <p><strong>Off</strong>: This is the default behavior. A hotkey press will be ignored whenever that hotkey is already running its maximum number of threads (usually 1, but this can be changed with <a href="_MaxThreadsPerHotkey.htm">#MaxThreadsPerHotkey</a>).</p></dd>
  19. </dl>
  20. <h3>Remarks</h3>
  21. <p>This directive is rarely used because this type of buffering, which is OFF by default, usually does more harm than good. For example, if you accidentally press a hotkey twice, having this setting ON would cause that hotkey's subroutine to automatically run a second time if its first <a href="../misc/Threads.htm">thread</a> takes less than 1 second to finish (this type of buffer expires after 1 second, by design). Note that AutoHotkey buffers hotkeys in several other ways (such as <code><a href="Thread.htm">Thread Interrupt</a></code> and <code><a href="Critical.htm">Critical</a></code>). It's just that this particular way can be detrimental, thus it is OFF by default.</p>
  22. <p>The main use for this directive is to increase the responsiveness of the keyboard's auto-repeat feature. For example, when you hold down a hotkey whose <a href="_MaxThreadsPerHotkey.htm">#MaxThreadsPerHotkey</a> setting is 1 (the default), incoming keypresses are ignored if that hotkey subroutine is already running. Thus, when the subroutine finishes, it must wait for the next auto-repeat keypress to come in, which might take 50ms or more due to being caught in between keystrokes of the auto-repeat cycle. This 50ms delay can be avoided by enabling this directive for any hotkey that needs the best possible response time while it is being auto-repeated.</p>
  23. <p>As with all # directives, this one should not be positioned in the script as though it were a command (i.e. it is not necessary to have it contained within a subroutine). Instead, position it immediately before the first hotkey label you wish to have affected by it.</p>
  24. <h3>Related</h3>
  25. <p><a href="_MaxThreads.htm">#MaxThreads</a>, <a href="_MaxThreadsPerHotkey.htm">#MaxThreadsPerHotkey</a>, <a href="Critical.htm">Critical</a>, <a href="Thread.htm">Thread (command)</a>, <a href="../misc/Threads.htm">Threads</a>, <a href="Hotkey.htm">Hotkey</a>, <a href="_MaxHotkeysPerInterval.htm">#MaxHotkeysPerInterval</a>, <a href="_HotkeyInterval.htm">#HotkeyInterval</a>, <a href="ListHotkeys.htm">ListHotkeys</a></p>
  26. <h3>Example</h3>
  27. <pre class="NoIndent">#MaxThreadsBuffer on
  28. #x::MsgBox, This hotkey will use this type of buffering.
  29. #y::MsgBox, And this one too.
  30. #MaxThreadsBuffer off
  31. #z::MsgBox, But not this one.</pre>
  32. </body>
  33. </html>