-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
alphabet medium-level covering #67
base: master
Are you sure you want to change the base?
Conversation
7165cf1
to
394c24b
Compare
With this commit I'm wondering if there is more idiomatic way of unwrapping misc types, when underlying API wants For example: let cmd: i32;
match command {
None => cmd = 0,
Some(id) => cmd = id.get() as i32,
} I would like to write something like: |
`add_project_marker` `add_project_marker_2` `set_tempo_time_signature_marker` `add_remove_rescript`
moved api_* functions
0d2528c
to
97630c1
Compare
07bfa8a
to
7b0b041
Compare
I've realized, that I not really understand the concept of usage scope. I mean, what should be in the main thread, and what — not. And should be this checked or not (are there any costs for this). |
`count_automation_items` `count_envelope_points` `count_envelope_points_ex` `count_take_envelopes` `count_takes` `count_selected_media_items` `count_selected_media_items_unchecked` `count_tempo_time_sig_markers` `count_tempo_time_sig_markers_unchecked`
`delete_envelope_point_ex` `delete_envelope_point_range` `delete_envelope_point_range_ex`
8c12a86
to
3d01fcc
Compare
`delete_project_marker` `delete_project_marker_unchecked` `delete_project_marker_by_index` `delete_project_marker_by_index_unchecked` `delete_take_marker` `delete_take_stretch_markers` `delete_tempo_time_signature_marker` `delete_tempo_time_signature_marker_unchecked`
In general, you need to know that most functions of the REAPER API are main-thread only. If you call them in any other thread, it's undefined behavior ... and that should be avoided at all costs because undefined behavior often means crash. There are a few functions which can be called from any thread and others that must be called from a real-time thread. The medium-level API attempts to provide safe functions (that "vow" not to exhibit undefined behavior), but of course only if that's possible without deviating from the original REAPER API function cut. That's often not possible. Fortunately, when it comes to avoiding undefined behavior due to usage from the wrong thread, it is possible 👍. That's why you find the That's why I consider the panic generated by The real challenge for you as medium-level API contributor :) is to figure out if a function is main-thread only or not. Because there are exceptions. And they are not documented by Cockos :( Usually, I always assume main-thread only and later make the usage scope more broad if I realize that was wrong. It's safer and better in terms of staying backward compatible. If I need it in the real-time thread, I usually write Justin an email and ask him if it's okay to use it from there. |
Wow. It became much clearer! Thank you. But, where do we really going out of the MainThread? Do I understand corretly, that all API listeners (ActionHook, CSurf) are still in the main thread? And shit can happen, mostly in three cases:
|
I'll move alphabetically through functions which can be straightforwardly wrapped. So, basically, this PR can be merged in master time to time without big concerns.