delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/12/02/18:31:49

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
MIME-Version: 1.0
Subject: SwitchToFiber call problem with cygwin_NT-5.2 ? test case below
Date: Thu, 2 Dec 2004 18:31:29 -0500
Message-ID: <AEA51B7AE4D7AF478E17707D295FF16A015781EA@ataexc02.americas.cpqcorp.net>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "Rearick, Gabriele" <gabriele DOT rearick AT hp DOT com>
To: "Rearick, Gabriele" <gabriele DOT rearick AT hp DOT com>, <cygwin AT cygwin DOT com>
X-OriginalArrivalTime: 02 Dec 2004 23:31:30.0328 (UTC) FILETIME=[0D1C8180:01C4D8C7]
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id iB2NVgu7023756

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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019