🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #51458

GCC and SUN OS 4.1.2 lightweight processes

#51458
From: Ron Stafford
Date: Tue, 18 May 1993 19:09
66 lines
2278 bytes
Has anyone been able to get lightweight processes on the SUN to work 
using GCC 2.3.3?

We have tried making all variables voltile and have used the 
-fpcc-struct-return switch on the compiler, but they still don't work.

The lwp_create call does not return to the parent until the child
process completes.
--------------------------- testlwp.c -----------------------
#include <lwp/lwp.h>
#include <lwp/lwpmachdep.h>
#include <lwp/stackdep.h>

#define MINSTACKSZ 1024
#define MAXPRIO 10

stkalign_t stack[1000+MINSTACKSZ];

main()
{
   int task();
   thread_t tid;

   printf("main here\n");
   (void) pod_setmaxpri(MAXPRIO);
   lwp_setstkcache( 1000, 2);

   printf("Start child\n");
   lwp_create( &tid, task, MAXPRIO, 0, lwp_newstk(), 0);
   printf("End child\n");

}


task()
{
   printf("Child process running.\n");
   for( ;; )
   {
     sleep( 2 );
   }
}
------------------------ end of testlwp.c -----------------------

The above routine seems to function when the "cc" compiler is used.
When the GCC compiler is used, the line:

 End child

is never printed.  If the task is modified to complete and exit.  The
"End child" line is printed after the child exits.

Can anyone tell us why this is happining?
Better, can someone identify a change, compile time flag, etc. which will
allow us to use the GCC compiler?

Thanks for your help

Ron Stafford



--------------------------------------------------------
Ron Stafford  (msgid RES) TEXAS INSTRUMENTS INCORPORATED
(214) 917-2050            P.O.Box 655012, MS 3620
STAFFORD@LOBBY.TI.COM     Dallas, Texas 75265-3620
Technical Details
Message-ID: <stafford.128.737752164@lobby.ti.com>
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!gatech!swrinde!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!fstop.csc.ti.com!lobby.ti.com!stafford

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,a92512ddd0d2a3e2,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-05-18 12:44:03 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!gatech!swrinde!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!fstop.csc.ti.com!lobby.ti.com!stafford
From: stafford@lobby.ti.com (Ron Stafford)
Subject: GCC and SUN OS 4.1.2 lightweight processes
Message-ID: <stafford.128.737752164@lobby.ti.com>
Lines: 66
Sender: usenet@csc.ti.com
Nntp-Posting-Host: 192.153.237.26
Organization: MHHC
Date: Tue, 18 May 1993 19:09:24 GMT