[flext] Threaded objects that aren't externals

Spencer Russell spencer.f.russell at gmail.com
Sun Nov 27 05:29:12 CET 2011


Thanks Thomas,

Declaring the method static and using LaunchThread was just the hint I
needed. Seems to be running smoothly now.

-s

On Sun, Nov 20, 2011 at 6:11 AM, Thomas Grill <gr at grrrr.org> wrote:
> Hi Spencer,
> i think there's some slight misunderstanding.
> If your class does not represent a Pd/Max object class (which it can't as
> it's static), you can't use any of those functions that interact with object
> classes/instances, such as FLEXT_THREAD_X or any other FLEXT_THREAD_*
> macros.
> You can inherit from the flext class though, which is just a namespace,
> simplifying access to static methods.
>
> Instead, to launch a thread you would use the flext::LaunchThread function,
> found in flsupport.h
>
> gr~~~
>
>> I've got an external where each instance of the external is sharing
>> access to a class (MantaManger) instance that's defined as static for
>> that class.
>>
>> The static object is supposed to handle a few threads that my externals
>> need.
>>
>> what should the class of my static object inherit from? flext,
>> flext_obj, flext_base?
>>
>> inheriting from flext gave errors when I tried to declare the threaded
>> method using the FLEXT_THREAD_X macro because my class didn't have a
>> "t_classid" member, which is defined in flext_obj.
>>
>> inheriting from flext_obj complained that:
>> error: invalid static_cast from type ‘flext_base_multi*’ to type
>> ‘MantaManager::thisType*’
>> in the FLEXT_THREAD_X macro because I didn't inherit from flext_base
>>
>> The only way to get past this was to inherit from flext_base, but I
>> was under the impression
>> that that's only supposed to be for classes that actually represent
>> externals. Am I doing
>> something wrong?
>>
>> Also, after having MantaManager inherit from flext_base I'm also
>> getting segfaults in the constructor in the
>> flext_obj_multi::HasAttributes() function.
>>
>> Thoughts?
>> _______________________________________________
>> http://grrrr.org/ext/flext
>>
>> flext mailing list
>> flext at grrrr.org
>> http://grrrr.org/cgi-bin/mailman/listinfo/flext
>
>


More information about the flext mailing list