🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.mac.oop.powerplant
6 messages
6 total messages Started by Frank Pollard Sat, 15 Sep 2001 20:07
LThread
#28
Author: Frank Pollard
Date: Sat, 15 Sep 2001 20:07
5 lines
1298 bytes
Error   : illegal use of abstract class ('LThread::Run()')
CNetClientApp.cp line 255   LThread muhThread;


How do I make a new thread? I need it to give to LHTTPConnection...
Re: LThread
#29
Author: Clark S. Cox III
Date: Sat, 15 Sep 2001 20:10
15 lines
1489 bytes
Frank Pollard <macman@macman.net> wrote:

> Error   : illegal use of abstract class ('LThread::Run()')
> CNetClientApp.cp line 255   LThread muhThread;

    This error is telling you that you need to subclass LThread, and
overload Run(), because LThread::Run() is a pure virtual function.

> How do I make a new thread? I need it to give to LHTTPConnection...


-- 
Clark S. Cox III
clarkcox3@yahoo.com
http://www.whereismyhead.com/clark/
Re: LThread
#30
Author: meeroh
Date: Sat, 15 Sep 2001 20:40
17 lines
1477 bytes
In article <3BA3B513.CFA6F0D7@macman.net>,
 Frank Pollard <macman@macman.net> wrote:

>Error   : illegal use of abstract class ('LThread::Run()')
>CNetClientApp.cp line 255   LThread muhThread;
>
>
>How do I make a new thread? I need it to give to LHTTPConnection...

LThread is an abstract class. I highly recommend reading the PP Advanced 
Topics books, which has examples of threads in PP

hth

meeroh
-- 
The contents of text files in a folder called "Random Signatures" in your Preferences folder are used as random signatures.
What am I missing?
#31
Author: Frank Pollard
Date: Mon, 17 Sep 2001 03:11
54 lines
2420 bytes
I re-read the relevant parts of PP Advanced Topics.

> You cannot instantiate an LThread object directly, because LThread
> is an abstract class. You must instantiate objects based on a class
> derived from LThread. This might be LSimpleThread, or a thread
> class of your own design.

And I subclassed LThread in my own class, but now I'm getting
threadProtocolErr (-619), at line 787 of LThread.cp. Which is this:

	if (inFlags & threadOption_Main)
	{
		// The user is creating the main thread.

		// This thread is handled specially, since it already exists when the
		// application starts executing.

		// we can't have a preemptive main thread, nor two main threads!
		if (inPreemptive || (sMainThread != NULL) || sInited)
			Throw_(threadProtocolErr);


Here's my code, what am I doing wrong?

#include <LThread.h>

class http : public LThread {
	public:
				http();
		
	protected:
		virtual void *		Run( void );

};



#include "http.h"

http::http()
	: LThread(	false, thread_DefaultStack, LThread::threadOption_Default, nil)
{
}

void*
http::Run( void )
{
	SysBeep(5);
	return nil;
}



UMainThread gets created in main(), right before theApp.Run() is called.
Re: What am I missing?
#32
Author: meeroh
Date: Mon, 17 Sep 2001 03:40
11 lines
1372 bytes
In article <3BA569E4.471E1531@macman.net>,
 Frank Pollard <macman@macman.net> wrote:

>UMainThread gets created in main(), right before theApp.Run() is called.

I do not believe you need to create a UMainThread by hand? Or am I 
typing on not enough sleep again?

meeroh
-- 
The contents of text files in a folder called "Random Signatures" in your Preferences folder are used as random signatures.
Re: What am I missing?
#33
Author: Frank Pollard
Date: Mon, 17 Sep 2001 18:23
21 lines
1920 bytes
> I do not believe you need to create a UMainThread by hand? Or am I
> typing on not enough sleep again?
> 
> meeroh

Hey you're right (even half asleep you're right :), I commented out that
line and now my program runs, and the thread actually works (I put a
SysBeep in the thread just to see/hear).


btw, "new UMainThread;" came with the new project, metrowerks put it there.

In the PP Advanced Topics book (page 65) it says:

> UMainThread is a concrete implementation of LThread. You must
> create a UMainThread object (or derivative) when your application
> launches, and before you create any other thread objects.



Thanks, to both of you who helped...
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads