[Mono-osx] Registering an NSThread with Mono
koheeney at gmail.com
Wed Nov 26 20:20:46 EST 2008
Okay, so I think it is an issue somehow with how I am invoking Mono.
When being called from the main thread, the following code works.
When being called from a separate thread, on the same object,
mono_string_to_utf8 (val) below returns NULL but does not throw an
field = mono_class_get_field_from_name (myMonoclass, [FieldName
mono_field_get_value (myMonoObject, field, &val);
p = mono_string_to_utf8 (val); //p here will be null when being
called from a secondary thread.
NSString* retStr = [[NSString alloc] initWithUTF8String:p]; //on
secondary threads, this line throws the exception "-
[NSPlaceholderString initWithUTF8String:]: NULL cString" because p is
I am doing more checks (like checking to make sure the field is
found, but I have removed that code in this sample).
On Nov 26, 2008, at 1:15 PM, Kevin Heeney wrote:
> I was thinking I had to pass mono_thread_attach a reference to a
> thread. Would calling mono_thread_attach(myDomain); work? If so,
> I might have a different issue.
> On Nov 26, 2008, at 1:03 PM, Kevin Heeney wrote:
>> Is there any way to register an NSThread with Mono? I am using a
>> 3rd party framework which I pass a delegate class and it launches
>> a new Thread. I have that class getting a reference to this
>> created Thread using [NSThread currentThread]. I now need to call
>> Mono from this thread but I need to register the thread using
>> "mono_thread_attach" I believe. Is there anyway that I can do
>> this with an NSThread?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-osx