-
Notifications
You must be signed in to change notification settings - Fork 544
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
Test for dispatch.h presence before using #610
base: master
Are you sure you want to change the base?
Conversation
Allows building on ancient OS X systems
What kind of performance impact does this have? The reason the dispatch API is used on macOS is because macOS's POSIX semaphores don't properly put the thread to sleep while waiting, causing high CPU load. What happens on these systems without the dispatch API? |
How do you suggest testing or what comparison would you like to see? |
Basically get an app that uses OpenAL and you know doesn't use much CPU power, that the percentage it uses of the CPU cores is relatively low while the device is open. Then with this change, run the app and look at how much it's using the CPU with an open device. If one of the threads has a core constantly pegged at or near 100%, it's not properly sleeping while waiting on semaphores. |
@kcat You are correct; even running |
Presuming it is an issue though, I'd think there would be an alternative somewhere. Maybe an alternate or lower-level API. Semaphores aren't that uncommon, so it would be weird for earlier versions of macOS to not have a way to do them properly. |
Here's a snippet from sampling
Let me know if I can provide more. |
That backtrace doesn't make much sense, if I'm reading it correctly. The |
@kcat Is there other information I can generate to help debug this? Maybe turn on logging? |
Logging and trying a debug build may help, which should allow getting line numbers and stack variable information. |
Here is the log before the hang occurs
|
A few related backtraces when I Control-C the process (three separate runs):
|
Well, that's certainly confusing. I can only guess some kind of memory corruption, though since it's the first call, I don't see how. Do any other apps using OpenAL Soft work? Is it just |
To my eyes it looks like the hang is occurring while attempting to handle an exception. Possibly the C++ run-time is buggy on this platform (it's 32-bit PPC running OS X 10.4.11; bugs in modern C++ run-times are fairly common here). I'll poke around and see if I can gather any more clues about the exception and go from there. |
@kencu Any ideas on this one? Do the unwind backtraces here look familiar? |
Iain mentioned he has had to replace some bits of libgcc on these old systems to make unwinding work properly, so the toolchain is possibly the culprit. re: the problem... libdispatch is available as a buildable separate project; I had considered trying to add it to Tiger and Leopard. Not sure if gcc will support blocks, though, and I think libdispatch requires them, so maybe no happiness that route in the end...not certain. May have to just patch this in MacPorts and live with the outcome? |
Ultimately the question will be if having a core constantly pegged at 100% utilization while a device is open is acceptable, since that seems to be what happens with Mac's As far as OpenAL Soft is concerned, all that's really needed here is a kind of 'sticky signal'. It doesn't have to hold a count like a real semaphore would, just a binary state with methods to |
@@ -489,6 +489,7 @@ check_include_file(guiddef.h HAVE_GUIDDEF_H) | |||
if(NOT HAVE_GUIDDEF_H) | |||
check_include_file(initguid.h HAVE_INITGUID_H) | |||
endif() | |||
check_include_file(dispatch/dispatch.h HAVE_DISPATCH_H) |
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.
@evanmiller This should also add a case of 10.6 ppc (whether native or Rosetta), since while a header is there, libdispatch
is unsupported for the arch.
@evanmiller @kcat If a case of 10.6/ppc could be added to the check (i.e. when the dispatch.h is present, but build is for |
Allows building on ancient OS X systems.