Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

멀티 쓰레드로 동작하는 앱을 작성하고 싶을 때 고려할 수 있는 방식들을 설명하시오. #168

Open
sustainable-git opened this issue Aug 7, 2022 · 1 comment
Labels

Comments

@sustainable-git
Copy link
Member

No description provided.

@sustainable-git
Copy link
Member Author

  • Multi thread를 활용하는 방법

    • Thread 객체를 생성한다.
      • Thread(target:, selector:, object:)로 생성한 후 start() 한다.
      • Thread를 subclassing한 class를 만들고 start() 한다.
      • Thread.detatchNewThreadSelector(_, toTatget:, with:) method를 실행한다.
      • Thread.detatchNewThreadWithBlock(_:) method를 실행한다.
  • DispatchQueue를 활용하는 방법

    • DispatchQueue.main 을 활용한다.
    • DispatchQueue.global(qos:) 을 활용한다.
  • OperationQueue를 활용하는 방법

    • BlockOperation(_:) method를 실행한다.
    • Operation을 subclassing 하여 사용한다.
    • OperationQueue를 생성해서 사용한다.
  • Swift Concurrency를 활용하는 방법

    • 함수에 await를 붙인다.
    • Swift Concurrency가 적용된 API를 이용한다.
    • withCheckedThrowingContinuatuin(function:, _:) method로 Wrapping 한다.
  • 고려할 수 있는 방식

    • Dispatch Queue와 Operation Queue를 사용할 때에는 다음을 고려해야 합니다.
      • 동기, 비동기
      • concurrent 여부
      • Qos

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant