1.. zephyr:code-sample:: posix-eventfd 2 :name: eventfd() 3 4 Use ``eventfd()`` to create a file descriptor for event notification. 5 6Overview 7******** 8 9This sample application demonstrates using the POSIX eventfd() function to create a file descriptor, 10which can be used for event notification. The returned file descriptor is used with write/read calls 11and write/read values are output to the console. 12 13Building and Running 14******************** 15 16This project outputs to the console. It can be built and executed on QEMU as follows: 17 18.. zephyr-app-commands:: 19 :zephyr-app: samples/posix/eventfd 20 :host-os: unix 21 :board: qemu_x86 22 :goals: run 23 :compact: 24 25For comparison, to build directly for your host OS if it is POSIX compliant (for ex. Linux): 26 27.. code-block:: console 28 29 cd samples/posix/eventfd 30 make -f Makefile.host 31 32The make output file will be located in samples/posix/eventfd/build. 33 34Sample Output 35============= 36 37.. code-block:: console 38 39 Writing 1 to efd 40 Writing 2 to efd 41 Writing 3 to efd 42 Writing 4 to efd 43 Completed write loop 44 About to read 45 Read 10 (0xa) from efd 46 Finished 47