Re: [AD] Mini-synchronization API proposal for 4.1.x |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Eric Botcazou wrote:
> No, but putting it there avoids to define another structure at the
> platform-dependent level for Win32, unless we change AL_MUTEX into a mere
> generic pointer. So we have two options for AL_MUTEX:
> - a platform-wide structure that also contains the fields needed by the
> various ports,
> - a pointer to a private structure defined by each port.
>
> The first one allows to easily add platform-wide fields if we ever choose to
> do so. But the second one is perhaps cleaner.
You could consider doing what GTK does (don't pin me on it as I don't
use it myself so I may be wrong): make a 'base class struct' with all
platform independent fields in it (easily adaptable for all platforms)
and make a 'derived' struct for each platform which contains as the
first member the 'base' struct.
You can then cast the total thing to a 'base' struct if you don't know
what type it is (yet), and once you do cast it to the 'derived' class.
I don't know how cross-platform compatible this is. Of course, if you
only plan on using these structs within platform specific code there's
no problem: you only need to address the struct as the 'derived' type
in that case.
Hein Zelle
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<
Hein Zelle hein@xxxxxxxxxx
http://www.icce.rug.nl/~hein
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<