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

Fix for Linux #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix for Linux #4

wants to merge 1 commit into from

Conversation

mominul
Copy link

@mominul mominul commented Jan 5, 2017

Hi, this pull request fixes errors that are occurring when compiling in Linux

  • On Linux the callback function argument is UnsafeMutableRawPointer?
  • pthread_t is non optional on Linux

Thanks to @jakeheis for his fork

I haven't tested it on macOS

@@ -83,16 +84,42 @@ public final class Spawn {
dynamicBuffer.deallocate(capacity: bufferSize)
return nil
}
#else
func callback(x: UnsafeMutableRawPointer?) -> UnsafeMutableRawPointer? {
Copy link

@esttorhe esttorhe Nov 29, 2018

Choose a reason for hiding this comment

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

I know that this repo is not mine or anything; but as seeing that the code inside the Linux path doesn't contain stuff that would fail compiling on macOS; wouldn't it be better to have something like macOSCallback and linuxCallback and then only applying the filtering inside of callback:

func callback(x: UnsafeMutableRawPointer?) -> UnsafeMutableRawPointer? {
#if(OSX)
   return macOSCallback(x)
#else
   return linuxCallback(x)
#endif
}

Edit: I think this would make it more readable; happy to discuss if this is not true or doesn't make sense or even if it really doesn't add any value.

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