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

Make EvenManager into singleton #698

Closed
boxerab opened this issue Jan 14, 2016 · 2 comments
Closed

Make EvenManager into singleton #698

boxerab opened this issue Jan 14, 2016 · 2 comments

Comments

@boxerab
Copy link
Contributor

boxerab commented Jan 14, 2016

Realistically, there should only be a single event manager for each run of the library.

Making this a singleton will simplify the code, since we don't have to pass it to methods.
Also, this will make it easier for any method to do logging, since we don't need to change
the method signature and pass in the EventManager.

@mayeut
Copy link
Collaborator

mayeut commented Jan 14, 2016

I think this is not a good idea.
What if someone integrates openjpeg and another library also using openjpeg ?
Then there's a chance to receive messages from the wrong run or nothing at all.
IMHO, singleton are to be used very carefully and issues are almost never seen in basic testing which is mostly done with only one instance of the encoder/decoder running at any given time. Even in simpler case than what I mentioned, let's say multithreading on top of openjpeg with one message queue per thread, then this will be a nightmare.

@boxerab
Copy link
Contributor Author

boxerab commented Jan 14, 2016

Good point. I just wish there was an easier way of logging inside a method without having to pass in the event manager.

@boxerab boxerab closed this as completed Jan 14, 2016
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

No branches or pull requests

2 participants