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

New callback dispatcher for .NET Standard 2.1 #392

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Akarinnnnn
Copy link
Contributor

Breaking changes included

  1. Enabled unsafe code to use Pointers for heap Allocation Free
  2. Changed event handler delegate's signature, use ref T instead of T to avoid copy the event param.
  3. Throw System.ArgumentException instead of System.Exception when user passed an invalid handler while creating Callresult<T> and Callback<T>

@Akarinnnnn
Copy link
Contributor Author

Examples for new handler

// For Callresult<T>
void OnCallresult(ref TypeName param, bool iofail)
{
    // do your operations
}

// For Callback<T>
void OnCallback(ref TypeName param)
{
    // do your operations
}

@rlabrecque
Copy link
Owner

I don't think we can do 1. as enabling unsafe on Unity is a pain. 2. & 3. seem good but we should probably wait until other breaking changes around here maybe: #389

@Akarinnnnn
Copy link
Contributor Author

I don't think we can do 1. as enabling unsafe on Unity is a pain. 2. & 3. seem good but we should probably wait until other breaking changes around here maybe: #389

I will add some #ifdef later to enable these pointer tricks just on .NET Core platforms. And we can wait for #389 for enough time to evaluate how this breaking changes impacts.

Force pushed this commit
1. Enabled unsafe code to use Pointers for heap Allocation Free
2. Changed event handler delegate's signerature, use `ref T` to avoid copy the event param.
3. Throw System.ArgumentException instead of System.Exception when user passed an invalid handler while creating Callresult<T> and Callback<T>
@Akarinnnnn Akarinnnnn force-pushed the low-alloc-dispatcher branch from 58293bc to 3888e43 Compare January 4, 2021 15:04
@Akarinnnnn
Copy link
Contributor Author

The new dispatcher was moved to a new file now.

@Akarinnnnn Akarinnnnn marked this pull request as draft December 11, 2023 13:29
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.

2 participants