Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

OR-5285 Timers:: RunLoop #141

Merged
merged 1 commit into from
Aug 17, 2023
Merged

OR-5285 Timers:: RunLoop #141

merged 1 commit into from
Aug 17, 2023

Conversation

crazymanish
Copy link
Owner

Context

In this PR

  • Timers using RunLoop
  • Before the Dispatch framework was available, developers relied on RunLoop to asynchronously perform tasks and implement concurrency.
  • Timer (NSTimer in Objective-C) could be used to create repeating and non-repeating timers.
  • Then Dispatch arrived and with it, DispatchSourceTimer.

  • Using RunLoop
  • The main thread and any thread you create, preferably using the Thread class, can have its own RunLoop.
  • It is always better, to use the main RunLoop that runs the main thread of your application. RunLoop.main
  • RunLoop class is not thread-safe. means You should only call RunLoop methods for the run loop of the current thread.
  • RunLoop defines several methods which are relatively low-level, and the only one benefit that lets you create cancellable timers

@crazymanish crazymanish linked an issue Aug 17, 2023 that may be closed by this pull request
@crazymanish crazymanish merged commit a07516e into main Aug 17, 2023
@crazymanish crazymanish deleted the OR-5285 branch August 17, 2023 17:44
@crazymanish crazymanish mentioned this pull request Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[w33(13august-19august)] Timers: Using RunLoop
1 participant