-
Notifications
You must be signed in to change notification settings - Fork 18
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
RCPP-8 Prepare vcpkg for submission #210
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
c85904e
get install working on macos
leemaguire 7ff6c0f
Update GHA workflow
leemaguire 7764312
fix quote
leemaguire c63e8eb
fix windows
leemaguire 234534a
switch to arm64 for macos
leemaguire 49e837c
Point to Core 14.8.0
leemaguire 766f460
Fix GHA workflow
leemaguire 67cd112
Lift default schedulers into SDK
leemaguire 09c13b7
Fix licence header
leemaguire ce0a9f5
Fix test
leemaguire e25df91
Remove unused Qt scheduler
leemaguire 7679cc3
Fix licence header
leemaguire a4fa7af
Address PR comments
leemaguire 68d3fe3
Add back uv scheduler
leemaguire e0a0f03
cleanup
leemaguire a64dab9
Remove unnecessary scheduler tests
leemaguire 38dfe33
More cleanup
leemaguire a608ad0
Cleanup scheduler tests
leemaguire 87b67ef
rename scheduler tests
leemaguire fd20cf3
Make sure scheduler is set during client reset
leemaguire 9b10c1e
bump conanfile
leemaguire File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
include/cpprealm/internal/scheduler/realm_core_scheduler.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
//////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Copyright 2024 Realm Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
//////////////////////////////////////////////////////////////////////////// | ||
|
||
#ifndef CPPREALM_REALM_CORE_SCHEDULER_HPP | ||
#define CPPREALM_REALM_CORE_SCHEDULER_HPP | ||
|
||
#include <cpprealm/scheduler.hpp> | ||
|
||
namespace realm { | ||
namespace util { | ||
class Scheduler; | ||
} | ||
} | ||
namespace realm::internal { | ||
|
||
/** | ||
* A type erased scheduler used for wrapping default scheduler implementations from RealmCore. | ||
*/ | ||
struct realm_core_scheduler final : public scheduler { | ||
/** | ||
* Invoke the given function on the scheduler's thread. | ||
* This function can be called from any thread. | ||
*/ | ||
void invoke(std::function<void()> &&fn) final; | ||
|
||
/** | ||
* Check if the caller is currently running on the scheduler's thread. | ||
* This function can be called from any thread. | ||
*/ | ||
[[nodiscard]] bool is_on_thread() const noexcept final; | ||
|
||
/** | ||
* Checks if this scheduler instance wraps the same underlying instance. | ||
* This is up to the platforms to define, but if this method returns true, | ||
* caching may occur. | ||
*/ | ||
bool is_same_as(const scheduler *other) const noexcept final; | ||
|
||
/** | ||
* Check if this scheduler actually can support invoke(). Invoking may be | ||
* either not implemented, not applicable to a scheduler type, or simply not | ||
* be possible currently (e.g. if the associated event loop is not actually | ||
* running). | ||
* | ||
* This function is not thread-safe. | ||
*/ | ||
[[nodiscard]] bool can_invoke() const noexcept final; | ||
~realm_core_scheduler() final = default; | ||
realm_core_scheduler() = delete; | ||
explicit realm_core_scheduler(std::shared_ptr<util::Scheduler> s) : s(std::move(s)) {} | ||
operator std::shared_ptr<util::Scheduler>(); | ||
private: | ||
std::shared_ptr<util::Scheduler> s; | ||
}; | ||
|
||
std::shared_ptr<util::Scheduler> create_scheduler_shim(const std::shared_ptr<scheduler>& s); | ||
} // namespace realm::internal | ||
|
||
#endif//CPPREALM_REALM_CORE_SCHEDULER_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
//////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Copyright 2024 Realm Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the >License>); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an >AS IS> BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
//////////////////////////////////////////////////////////////////////////// | ||
|
||
#ifndef CPPREALM_DEFAULT_SCHEDULERS_HPP | ||
#define CPPREALM_DEFAULT_SCHEDULERS_HPP | ||
|
||
#include <cpprealm/scheduler.hpp> | ||
|
||
#if __has_include(<cpprealm/util/config.h>) | ||
#include <cpprealm/util/config.h> | ||
#endif | ||
|
||
#if defined(REALM_HAVE_UV) && REALM_HAVE_UV | ||
typedef struct uv_loop_s uv_loop_t; | ||
#endif | ||
|
||
namespace realm::default_scheduler { | ||
/** | ||
* Tries to choose a built in scheduler as default for the platform | ||
* Current options are: | ||
* - CFRunLoop for Apple platforms | ||
* - UV for Linux and Windows | ||
* - ALooper for Android | ||
* If no suitable scheduler is available a generic scheduler will be provided. | ||
*/ | ||
std::shared_ptr<scheduler> make_platform_default(); | ||
|
||
/** | ||
* Register a factory function which can produce custom schedulers when | ||
* `scheduler::make_default()` is called. This function is not thread-safe | ||
* and must be called before any schedulers are created. | ||
*/ | ||
void set_default_factory(std::function<std::shared_ptr<scheduler>()>&& factory_fn); | ||
|
||
/** | ||
* Create a new instance of the scheduler type returned by the default | ||
* scheduler factory. By default, the factory function is | ||
* `scheduler::make_platform_default()`. | ||
*/ | ||
std::shared_ptr<scheduler> make_default(); | ||
} // namespace realm | ||
|
||
#endif//CPPREALM_DEFAULT_SCHEDULERS_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I assume that
UWP
is checked byWINDOWS_STORE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed