🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #49747

SUN LWP and gcc.

#49747
From: Gordon C Joly
Date: Tue, 14 Dec 1993 17:14
60 lines
1703 bytes

A colleague is trying to use SUN's "lwp" (threads) package under SunOS
4.1.x (and gcc 2.3.3 and 2.5.2).

The following code works with /bin/cc but not gcc. This example is
based on the SUN Answerbook code.

Please reply by email.


#include <lwp/lwp.h>
#include <lwp/stackdep.h>

main(argc,argv)
int argc;
char *argv[];
{
	int scheduler(),task(),i;
	(void)pod_setmaxpri(10);

	lwp_setstkcache(1000,5);
	
	(void)lwp_create((thread_t*)0,scheduler,10,0,lwp_newstk(),0);
	for (i=0;i<5;i++)
	{
		(void) lwp_create((thread_t*)0,task,5,0,lwp_newstk(),1,i);
	}
	exit(0);
}

scheduler()
{
	struct timeval quantum;
	quantum.tv_sec=0;
	quantum.tv_usec=10000;
	for (;;)
	{
		lwp_sleep(&quantum);
		lwp_resched(5);
	}
}

task(i)
int i;
{
	for (;;) 
	{
		printf("Task %d.\n",i);
	}
}



Thanks in Advance
Gordo
--
Gordon Joly      Phone  +44 71 380 7777 ext 3703      FAX  +44 71 387 1397
Internet: G.Joly@cs.ucl.ac.uk                            ucacgcj@ucl.ac.uk
Computer Science, University College London, Gower Street, LONDON WC1E 6BT
Technical Details
Message-ID: <1993Dec14.171437.52055@ucl.ac.uk>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!pipex!uknet!bcc.ac.uk!link-1.ts.bcc.ac.uk!ucacgcj

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,33d5775aaed9a9e1,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-12-14 13:15:31 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!pipex!uknet!bcc.ac.uk!link-1.ts.bcc.ac.uk!ucacgcj
From: ucacgcj@ucl.ac.uk (Gordon C Joly)
Subject: SUN LWP and gcc.
Sender: news@ucl.ac.uk (Usenet News System)
Message-ID: <1993Dec14.171437.52055@ucl.ac.uk>
Date: Tue, 14 Dec 1993 17:14:37 GMT
Organization: Bloomsbury Computing Consortium
Keywords: lwp,threads, SunOS
Followup-To: G.Joly@ucl.ac.uk
Lines: 60