samples/cpp/cpp_synchronization/README.html · samples/cpp/cpp_synchronization/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · C++ Kernel

C++ Synchronization

Main·cooperative thread가 semaphore로 번갈아 greeting을 출력합니다.

Official pathsamples/cpp/cpp_synchronization/README.html
Source filesamples/cpp/cpp_synchronization/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Pure virtual class와 constructor부터 scheduling·timing까지 설명합니다.

Threads

Main · Cooperative

Control

Timer · Semaphore

Target

QEMU x86

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 535F668164F9048A20BA0D61D0CA2F698470AD1EBDB6A7E9A4A79209F079D72A
.. _cpp_synchronization:

C++ Synchronization
###################

Overview
********
The sample project illustrates usage of pure virtual class, member
functions with different types of arguments, global objects constructor
invocation.

A simple application demonstrates basic sanity of the kernel.  The main thread
and a cooperative thread take turns printing a greeting message to the console,
and use timers and semaphores to control the rate at which messages are
generated. This demonstrates that kernel scheduling, communication, and
timing are operating correctly.

Building and Running
********************

This kernel project outputs to the console.  It can be built and executed
on QEMU as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/cpp/cpp_synchronization
   :host-os: unix
   :board: qemu_x86
   :goals: run
   :compact:

Sample Output
=============

.. code-block:: console

     Create semaphore 0x001042b0
     Create semaphore 0x001042c4
     main: Hello World!
     coop_thread_entry: Hello World!
     main: Hello World!
     coop_thread_entry: Hello World!
     main: Hello World!
     coop_thread_entry: Hello World!
     main: Hello World!
     coop_thread_entry: Hello World!
     main: Hello World!
     coop_thread_entry: Hello World!
     main: Hello World!
     coop_thread_entry: Hello World!
     main: Hello World!
     coop_thread_entry: Hello World!
     main: Hello World!
     coop_thread_entry: Hello World!
     main: Hello World!
     coop_thread_entry: Hello World!
     main: Hello World!

     <repeats endlessly>

Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.

Part 3

한국어 전문 번역

개요

Pure virtual class, 서로 다른 argument type을 받는 member function, global object constructor 호출의 사용법을 보여주는 sample project입니다.

간단한 application으로 kernel의 기본 건전성을 확인합니다. Main thread와 cooperative thread가 번갈아 console에 greeting message를 출력하며, timer와 semaphore로 message 생성 속도를 제어합니다. 이를 통해 kernel scheduling, communication, timing이 올바르게 동작하는지 보여줍니다.

Build와 실행

이 kernel project는 console로 출력합니다. QEMU에서는 다음과 같이 build하고 실행할 수 있습니다.

west build -b qemu_x86 samples/cpp/cpp_synchronization
west build -t run

Sample 출력

Create semaphore 0x001042b0
Create semaphore 0x001042c4
main: Hello World!
coop_thread_entry: Hello World!
main: Hello World!
coop_thread_entry: Hello World!
main: Hello World!
coop_thread_entry: Hello World!
main: Hello World!
coop_thread_entry: Hello World!
main: Hello World!
coop_thread_entry: Hello World!
main: Hello World!
coop_thread_entry: Hello World!
main: Hello World!
coop_thread_entry: Hello World!
main: Hello World!
coop_thread_entry: Hello World!
main: Hello World!
coop_thread_entry: Hello World!
main: Hello World!

<repeats endlessly>

QEMU를 종료하려면 CTRL+A를 누른 뒤 x를 누릅니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.