🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.oodesign
Article #50

Re: Problem with accessing Queue from worker thread

#50
From: Daniel Stevenson
Date: Tue, 22 Mar 2005 20:59
85 lines
3967 bytes
Thank you very much, I thought I needed an extern declaration which I tried
but i wasn't declaring the object in the cpp file correctly.

Thanks heaps, its all working now.

"Eelke" <e.klein@mplussoftware.nl> wrote in message
news:423fc937$1@newsgroups.borland.com...
>
> > I don't think there is anything wrong with the above declaration, I
included
> > this to reduce the number of questions in this area.
> > I think the problem is in how I've declared my queue but I'm having a
brain
> > freeze and can't think straight to work out my problem as seen below.
> >
> >
> > ....LoggingServiceSource.h...
> >
//--------------------------------------------------------------------------
> > -
> > #ifndef LoggingServiceSourceH
> > #define LoggingServiceSourceH
> >
//--------------------------------------------------------------------------
> > -
> > #include <SysUtils.hpp>
> > #include <Classes.hpp>
> > #include <SvcMgr.hpp>
> > #include <vcl.h>
> > #include "thdLoggingSource.h"
> > #include <OleServer.hpp>
> > #include <queue>
> > using namespace std;
> >
//--------------------------------------------------------------------------
> > -
> > TLogQueue<LogStruct> LogQueue;            //declaring my queue
> >
//--------------------------------------------------------------------------
> > -
> > class TLoggingService : public TService
> > {
> > __published:    // IDE-managed Components
> >   TatSystemStatus *atSystemStatus;
> >   TatPagingSubscription *atPagingSubscription;
> >   void __fastcall atSystemStatusSystemStatus(TObject *Sender,
> >           atSystemStatusType StatusType, BSTR Origin,
> >           atSystemStatusLevel Level, BSTR Description);
> >   void __fastcall atPagingSubscriptionPaging(TObject *Sender,
> >           BSTR CallNumber, BSTR DisplayMessage, long Priority,
> >           PagingInfoStruct *AdditionalInfo);
> > private:        // User declarations
> >   TLoggingThread *LoggingThread;
> >   String ConnectionStatus;
> >
> >   void __fastcall UpdateServiceDescription(TService *Sender);
> >   void __fastcall CreateWorkerThread();
> >   void __fastcall CheckSystemStatus();
> > public:         // User declarations
> >  __fastcall TLoggingService(TComponent* Owner);
> >  TServiceController __fastcall GetServiceController(void);
> >
> >  friend void __stdcall ServiceController(unsigned CtrlCode);
> > };
> >
//--------------------------------------------------------------------------
> > -
> > extern PACKAGE TLoggingService *LoggingService;
> >
//--------------------------------------------------------------------------
> > -
> > #endif
> >
> You declared the queue in the header which causes each cpp which
> includes this header to get its own copy. Change the declaration to
>
> extern TLogQueue<LogStruct> LogQueue;
>
> and put
>
> TLogQueue<LogStruct> LogQueue;
>
> in one cpp.
>
> Eelke
Technical Details
Message-ID: <42408739$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <423f6b65@newsgroups.borland.com> <423fc937$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10db1e,62ae9303d665b63f
X-Google-Attributes: gid10db1e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Daniel Stevenson" <d.stevenson@ocreage.com.au>
Newsgroups: borland.public.cppbuilder.oodesign
References: <423f6b65@newsgroups.borland.com> <423fc937$1@newsgroups.borland.com>
Subject: Re: Problem with accessing Queue from worker thread
Date: Wed, 23 Mar 2005 07:59:34 +1100
Lines: 87
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 202.174.233.53
Message-ID: <42408739$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1111525177 202.174.233.53 (22 Mar 2005 12:59:37 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail