[Mono-dev] System.Threading.Thread.ApartmentState Patch

Jonathan Chambers joncham at gmail.com
Thu May 3 14:06:02 EDT 2007


Attached is new patch (hopefully) addressing all previous issues. I renamed
methods to mono_thread_init_apartment_state and
mono_thread_cleanup_apartment_state.

Thanks,
Jonathan

On 5/3/07, Paolo Molaro <lupus at ximian.com> wrote:
>
> On 05/02/07 Jonathan Chambers wrote:
> > Index: mono/mono/metadata/threads.c
> > ===================================================================
> > --- mono/mono/metadata/threads.c      (revision 76569)
> > +++ mono/mono/metadata/threads.c      (working copy)
> [...]
> > +void mono_thread_set_apartment_state ()
> > +{
>
> should be:
>
> void
> mono_thread_set_apartment_state (void)
>
> It may also be better to name the function
> mono_thread_apply_apartment_state.
>
> > Index: mono/mono/metadata/object.c
> > ===================================================================
> > --- mono/mono/metadata/object.c       (revision 76569)
> > +++ mono/mono/metadata/object.c       (working copy)
> > @@ -2387,6 +2387,7 @@
> [...]
> > +     cinfo = mono_custom_attrs_from_method (method);
> > +     if (cinfo) {
> > +             static MonoClass *stathread_attribute = NULL;
> > +             MonoThread* thread = mono_thread_current ();
> > +             MonoObject* stathread_object;
> > +             if (!stathread_attribute)
> > +                     stathread_attribute = mono_class_from_name
> (mono_defaults.corlib, "System", "STAThreadAttribute");
> > +             mono_custom_attrs_get_attr (cinfo, stathread_attribute);
>
> As zoltan said, use mono_custom_attrs_has_attr().
>
> > Index: mono/mono/metadata/object-internals.h
> > ===================================================================
> > --- mono/mono/metadata/object-internals.h     (revision 76569)
> > +++ mono/mono/metadata/object-internals.h     (working copy)
> > @@ -274,7 +274,7 @@
> >       MonoBoolean thread_dump_requested;
> >       gpointer end_stack; /* This is only used when running in the
> debugger. */
> >       MonoBoolean thread_interrupt_requested;
> > -     gpointer unused4;
> > +     guint32 apartment_state;
>
> Since you need just 2 bits, please use a guint8 type.
>
> Thanks!
>
> lupus
>
> --
> -----------------------------------------------------------------
> lupus at debian.org                                     debian/rules
> lupus at ximian.com                             Monkeys do it better
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070503/dea51290/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: apartmentstate.diff
Type: text/x-patch
Size: 12209 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070503/dea51290/attachment.bin 


More information about the Mono-devel-list mailing list