This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

During building some code I get "... should have been declared inside ..."


Hi,


I get some code, I'm able to build this code on gcc412 without? any
errors (debian4 x86_64),? but when I try build the same code on gcc432
(debian 5 x86_64) I get:

ServiceConfiguration.cxx:39:? error: ‘void* glite::config::service_main(
void*)’ should have been declared inside ‘glite::config’.

The problem is that I cant not force developers to improves this code
because they are support only SLC5 (with gcc412) :(

Any idea will be very helpful.

Here is ServiceConfiguration.cxx:

#include "glite/data/config/service/ServiceConfiguration.hxx"
#include <stdio.h>
#include <signal.h>
#include <sys/wait.h>
#include <unistd.h>

using namespace glite::config;


void *glite::config::service_main(void * data);

}
}
/**
?* Start the Component
?*/
int ServiceConfiguration::start(){

??? // Wait the Main Thread Is Started
??? sem_init(&_synch,0,0);
??? pthread_create(&_tid, NULL, service_main,this);
??? sem_wait(&_synch);

??? return 0;
}

/**
?* Stop the Component
?*/
int ServiceConfiguration::stop(){
??? // Set run Flag
??? this->svc_stop();

??? // Wait Thread is finished
??? pthread_join(_tid, 0);

??? return 0;
}


/**
?* Do doLoop
?*/
void ServiceConfiguration::run(){
??? // Post The Semaphore
??? sem_post(&_synch);

??? // Invoke The Service Mai Method
??? this->svc();
}

/**
?* Module Main Function
?*/

void *glite::config::service_main(void * data){

??? ServiceConfiguration * service =
reinterpret_cast<ServiceConfiguration *>(data);
??? service->run();

??? return 0;
}


And here is ServiceConfiguration.hxx:

#ifndef GLITE_DATA_CONFIG_SERVICE_SERVICECONFIGURATION_HXX_
#define GLITE_DATA_CONFIG_SERVICE_SERVICECONFIGURATION_HXX_

#include "glite/data/config/service/ComponentConfiguration.hxx"
#include <pthread.h>
#include <semaphore.h>

namespace glite {
namespace config{

/**
?* ServiceConfiguration
?* Base class for implementing a Service Provider with a dedicated thread
?*/
class ServiceConfiguration: public ComponentConfiguration {
public:

??? /**
???? * Start the Service Thread
???? * @return 0 if success
???? */
??? virtual int start();

??? /**
???? * Stop the Service
???? * @return 0 if success
???? */
??? virtual int stop();

protected:

??? /**
???? * Constructor
???? * @param name [IN] the service provider name
???? */
??? ServiceConfiguration(const char * name):ComponentConfiguration(name){}

??? /**
???? * Destructor
???? */
??? virtual ~ServiceConfiguration(){}

??? /**
???? * Service Main Method. This method should contain the service provider main
???? * loop
???? * @return 0 if success
???? */
??? virtual int svc() = 0;

??? /**
???? * Callback to interrupt the Service Thread. The service should provide a
???? * way to exit from the main loop
???? */
??? virtual int svc_stop() = 0;

private:

??? /*
???? * Not Implemented
???? */
??? ServiceConfiguration();

??? friend void *service_main(void * data);
??? /**
???? * Call the Service Main Method
???? */
??? void run();

protected:

??? /**
???? * Thread Identifier Property
???? */
??? pthread_t _tid;

private:
??? /*
???? * Initialization Semaphore
???? */
??? sem_t _synch;
};

} // End namespace config
} // End namespace glite

#endif //GLITE_DATA_CONFIG_SERVICE_SERVICECONFIGURATION_HXX_


This softvare org.glite.data.config-service could be downloaded?? from:

cvs -d :pserver:anonymous@glite.cvs.cern.ch:/cvs/glite co -r
glite-data-config-service_R_2_4_0_1 org.glite.data.config-service

Best Regards
Adrian Stelmaszyk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]