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

GEODE-4427: Moving CliCallbackMethod to DistributedSystemImpl #233

Merged
merged 2 commits into from Mar 13, 2018

Conversation

pdxcodemonkey
Copy link
Contributor

No description provided.

Copy link

@echobravopapa echobravopapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely, c++11 constructs and removing dead code

Copy link

@echobravopapa echobravopapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows won't build
C:\nativeclient\clicache\src\DistributedSystem.cpp(498): error C2440: 'type cast': cannot convert from 'void *' to 'apache::geode::client::CliCallbackMethod' [C:\build\clicache\src\Apache.Geode.vcxproj]
C:\nativeclient\clicache\src\DistributedSystem.cpp(498): note: No constructor could

Signed-off-by: Blake Bender <bbender@pivotal.io>
@mcmellawatt
Copy link
Contributor

Fixed the build issue, needed some changes in the c++/cli.

@@ -493,7 +493,7 @@ namespace Apache
&CliCallbackDelegate::Callback);

native::DistributedSystemImpl::registerCliCallback(System::Threading::Thread::GetDomainID(),
(native::CliCallbackMethod)System::Runtime::InteropServices::
(void (*)(apache::geode::client::Cache &cache))System::Runtime::InteropServices::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that you remove a C-style function pointer on C++ side (which I think is appropriate), is there any reason to perpetuate the C-style function pointer here? If you must, then why not use a C++ style cast? Furthermore, is it possible to replace CliCallbackDelegate and cliCallback with some std::functional magic now that that's what will be used in the C++ side?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cast is required because the delegate function pointer given by this call is a void*. It won’t convert to anything that matches std::function will accept.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to use delegates? Was that required because of appdomain fun? If so, is it still relevant in a world without globals?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly we still need this delegate to call back from the native side into the .NET side for cleanup when the cachenis closed. It could probably be refactored but its outside this scope.

@jake-at-work jake-at-work merged commit 7b32fed into apache:develop Mar 13, 2018
jake-at-work pushed a commit to jake-at-work/geode-native that referenced this pull request Oct 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants