.. _Extended6Input:

.. raw:: html

   <script>ODSA.SETTINGS.DISP_MOD_COMP = true;ODSA.SETTINGS.MODULE_NAME = "Extended6Input";ODSA.SETTINGS.MODULE_LONG_NAME = "Extended Example: Keyboard Input Listener";ODSA.SETTINGS.MODULE_CHAPTER = "Concurrency with Multithreading"; ODSA.SETTINGS.BUILD_DATE = "2021-06-01 12:51:47"; ODSA.SETTINGS.BUILD_CMAP = false;JSAV_OPTIONS['lang']='en';JSAV_EXERCISE_OPTIONS['code']='java';</script>


.. |--| unicode:: U+2013   .. en dash
.. |---| unicode:: U+2014  .. em dash, trimming surrounding whitespace
   :trim:


.. This file is part of the OpenCSF eTextbook project. It was
.. auto-generated by scripts from the OpenDSA eTextbook project.
.. See https://OpenCSF.org for more details. OpenCSF is distributed
.. under a Creative Commons Attribution-NonCommercial 4.0 International
.. License (see http://creativecommons.org/licenses/by-nc/4.0/),
.. Copyright (c) 2019-2021 by Michael S. Kirkpatrick. OpenDSA is
.. distributed under an MIT open source license, Copyright (c) 2012-2021
.. by the OpenDSA Project Contributors.

.. avmetadata::
   :author: Michael S. Kirkpatrick
   :requires:
   :satisfies: 
   :topic: 

Extended Example: Keyboard Input Listener
=========================================

This example illustrates how threads can be created to perform a particular
task. This style of multithreading forms the basis of programs that have
graphical user interfaces. Specifically, the example shown here acts as a custom
keyboard event listener; the child thread continually reads from the keyboard
until the user enters exactly a 7. Similarly, programs with mouse event handlers
use threads specifically for that purpose.

.. codeinclude:: Threads/ExtEx-6-1.c
   :linenos: true

