This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SwitchToFiber call problem with cygwin_NT-5.2 ? test case below


Hi all

cygwin version:  CYGWIN_NT-5.2 rearick3 1.5.12(0.116/4/2) 2004-11-10
08:34 amd64 unknown unknown Cygwin.

I am uncertain if the platform above is an "officially supported"
platform, but apparently the same problem behavior is exposed on
officially supported environments, as it was indicated to me.

The testcase below from Gengbin Zheng demonstrates a program hang/crash
when envoking fibers (switchToFiber call).  Might it be related to SP2
and/or version of win32api? cygcheck.out is attached.  

Can the issue be fixed or is there a fix already?

thanks
------

name this file as fiber.c  (note make it a C file, not C++)

now compile it under VC++, it runs as expected.
when compile with gcc:   gcc -o fiber fiber.c
It crashes at SwitchToFiber call.

#include 
<stdio.h>


#include <windows.h>
#include <winbase.h>
 


#ifndef _WIN32_WINNT
#define _WIN32_WINNT  0x0400
#endif
 


#if(_WIN32_WINNT >= 0x0400)
typedef VOID (WINAPI *PFIBER_START_ROUTINE)(
    LPVOID lpFiberParameter
    );
typedef PFIBER_START_ROUTINE LPFIBER_START_ROUTINE; #endif
 


#if(_WIN32_WINNT >= 0x0400)
WINBASEAPI
LPVOID
WINAPI
CreateFiber(
    DWORD dwStackSize,
    LPFIBER_START_ROUTINE lpStartAddress,
    LPVOID lpParameter
    );
 


WINBASEAPI
VOID
WINAPI
DeleteFiber(
    LPVOID lpFiber
    );
 


WINBASEAPI
LPVOID
WINAPI
ConvertThreadToFiber(
    LPVOID lpParameter
    );
 


WINBASEAPI
VOID
WINAPI
SwitchToFiber(
    LPVOID lpFiber
    );

 


#endif /* _WIN32_WINNT >= 0x0400 */
 



 /* thread entry */ 
 


VOID CALLBACK FiberSetUp(PVOID fiberData) {
  printf("HERE in fiber\n");
}
 


int main()
{
  LPVOID fiber;
 


  if (NULL==ConvertThreadToFiber(NULL)) {
    printf("ConvertThreadToFiber failed.\n");
    exit(1);
  }
 


  fiber = CreateFiber(0, FiberSetUp, (void *) NULL);
  if (NULL == fiber) {
    printf("CreateFiber failed.\n");
    exit(1);
  }
 


  printf("HERE before switch \n");
  SwitchToFiber(fiber);

}





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]