Hi,
I have some code which transfers an NSInvocation to another thread
to execute. Before doing this, it sets the return value to a
proxy. I now have the problem on GNUstep that when I fire the
invocation in the second thread that it writes the result to the
stack on the original thread.
OS X does something with NSInvocations that deals with the special
case that the function constructing the NSInvocation returns before
the NSInvocation is fired by having the function that calls
forwardInvocation: block until the invocation has fired once and
then, when the function returns, setting the invocation to store its
result internally in a buffer that can be accessed with
getReturnValue:.
With GNUstep it is possible to emulate this behaviour using libffi
but not ffcall. The _storeRetval method on NSInvocation appears to
work correctly with FFI, ensuring that the return value is stored in
the invocation. With ffcall, this method is not implemented, and
setting _retval manually results in the return value being stored in
both the specified location and in the original location.
David
_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnustep