Article View: gnu.gcc.help
Article #51482re: GCC and SUN OS 4.12 lightweight processes - workaround
From: Ron Stafford
Date: Sat, 22 May 1993 12:38
Date: Sat, 22 May 1993 12:38
83 lines
2558 bytes
2558 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.
Workaround:
Compile the following with "cc" for an object file.
-------------------------------------------
#include <lwp/lwp.h>
#include <lpu/lwpmachdep.h>
#include <lpw/stackdep.h>
main( argc, argv )
int argc;
char ** argv;
{
main2( argc, argv );
}
------------------------------------------
Compile all remaining source with gcc.
>--------------------------- 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()
^^^^^^
main2()
>{
> 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(i=0 ; i<5 ; i++ )
> {
> sleep( 2 );
> }
>}
>------------------------ end of testlwp.c -----------------------
Link the "main" program and gcc generated "application" routines.
LWP will function as advertized. I don't know why this works other than
a guess that there is some "setup" for lightweight processes in the
"cc" initialization routine.
--------------------------------------------------------
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.132.738074297@lobby.ti.com>Path:
arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!news.dfn.de!darwin.sura.net!howland.reston.ans.net!usc!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!fstop.csc.ti.com!lobby.ti.com!staffordShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,512aaa65c9a36c09,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-05-22 05:57:06 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!news.dfn.de!darwin.sura.net!howland.reston.ans.net!usc!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: re: GCC and SUN OS 4.12 lightweight processes - workaround Message-ID: <stafford.132.738074297@lobby.ti.com> Lines: 83 Sender: usenet@csc.ti.com Nntp-Posting-Host: 192.153.237.26 Organization: MHHC Date: Sat, 22 May 1993 12:38:17 GMT