PATCH: implemented Fiber APIs

Alberto Massari alby at exln.com
Tue Dec 17 03:59:31 CST 2002


At 02.02 17/12/2002 -0500, Dimitrie O. Paun wrote:
>On December 16, 2002 02:37 pm, Alberto Massari wrote:
> > +void WINAPI SwitchToFiber(LPVOID lpFiber)
> > +{
> > +#ifdef HAVE_UCONTEXT_H
> > +    PHFIBER pFiber,pCurrentFiber;
> > +    pFiber=(PHFIBER)lpFiber;
> > +    pCurrentFiber=(PHFIBER)TlsGetValue(fiber_tls_index);
> > +    TRACE("Switching from %p to %p\n",pFiber,pCurrentFiber);
> > +    TlsSetValue(fiber_tls_index,pFiber);
> > +    swapcontext(&pCurrentFiber->context,&pFiber->context);
> > +#else
> > +    FIXME("stub\n");
> > +#endif
> > +}
>
>Can you (pretty) please do without the ifdefs? They can probably
>be located in only one spot, if you need to test for HAVE_UCONTEXT_H.

I added them when I realized that ucontext.h could not be present on some 
systems, as "configure" tests for its presence and adds that preprocessor 
directive.
The alternative layout would be

#ifdef HAVE_UCONTEXT_H

#include <ucontext.h>

LPVOID WINAPI ConvertThreadToFiber(...
{
   ....
}

LPVOID WINAPI CreateFiber(...
{
   ....
}
....

#else

LPVOID WINAPI ConvertThreadToFiber(...
{
    FIXME("stub\n");
}

LPVOID WINAPI CreateFiber(...
{
    FIXME("stub\n");
}
...

#endif

It's just a matter of deciding what is best from a maintenance point of 
view: grouping the working code or grouping the functions.
There are valid arguments in favour of both styles, and I have no strong 
feelings, so I will submit the new patch shortly.
In any case... what is the policy in this case?
a) there is an HOWTO on the subject, that I didn't read :-(
b) there is no previous agreement on this, and Alexandre decides
c) there is no previous agreement on this, and a poll is submitted to the 
mailing list
d) other options

Alberto

-------------------------------
Alberto Massari
eXcelon Corp.
http://www.StylusStudio.com





More information about the wine-devel mailing list