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

removed some unnecessary shared_ptr #81 #3275

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

blackbird806
Copy link
Contributor

For the SDL_Semaphore going back to raw C style is what seemed the most straightforward for me, using unique ptr with custom deleter feels overkill since it's only destroyed at one place.

@github-actions github-actions bot added kernel Relatead to the kernel/OS audio labels Apr 16, 2024
@Macdu
Copy link
Contributor

Macdu commented Apr 24, 2024

Nice (although I'm not sure whether I would prefer to use a reference instead of a pointer for mz_zip_archive).
For the semaphore stuff, what the code is doing right now is

  • Thread 1 allocates ThreadParams on its stack then starts Thread 2
  • Thread 2 copies ThreadParams to it stack then notifies Thread 1 using a semaphore
  • Thread now can now return, making the inital ThreadParams invalid

This is really overcomplicated for nothing, it would be a lot easier to just do:

  • Thread 1 allocates ThreadParams on the heap using new, starts Thread 2 and return
  • Thread 2 reads ThreadParams then delete it using delete
    No more need for a semaphore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audio kernel Relatead to the kernel/OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants