본문 바로가기
Game Programming Study 게임 개발 프로그래밍 공부

[SFML / Code::Blocks] sf::thread 스레드 예제 테스트 실행

by byungwoo733 2023. 5. 9.
728x90
반응형
SMALL

sf::thread 스레드 예제 테스트 실행 공부

아직 sf::thread용도는 아직 잘 모르겠음. 

main.cpp

#include <SFML/System.hpp>
#include <iostream>

void func()
{
    // this function is started when thread.launch() is called

    for (int i = 0; i < 10; ++i)
        std::cout << "I'm thread number one" << std::endl;
}

int main()
{
    // create a thread with func() as entry point
    sf::Thread thread(&func);

    // run it
    thread.launch();

    // the main thread continues to run...

    for (int i = 0; i < 10; ++i)
        std::cout << "I'm the main thread" << std::endl;

    return 0;
}

 

=======================================

 

* (주의) 여기 예제나 글들은 게임개발에 도움이 되는 정보 보다는 개인 공부을 위한 것이어서 옳은 방법이 아닐 수 있으니 참고바랍니다.

728x90
LIST

댓글