// Parse if parents data type name of a data type are defined in the
// datatype catalog
+#ifndef WNT
for (unsigned int ind = 0; ind < _datatype_list.size(); ind++)
+#else
+ for (ind = 0; ind < _datatype_list.size(); ind++)
+#endif
{
// Scrute data type parents
// MESSAGE("Treatment of " << _datatype_list[ind].Parserdata_name);
MESSAGE("GenericObj_i::GenericObj_i() - this = "<<this<<
"; CORBA::is_nil(thePOA) = "<<CORBA::is_nil(thePOA));
if(CORBA::is_nil(thePOA))
+#ifndef WNT
myPOA = PortableServer::RefCountServantBase::_default_POA();
+#else
+ myPOA = RefCountServantBase::_default_POA();
+#endif
else
myPOA = PortableServer::POA::_duplicate(thePOA);
}
#ifndef __WIN32__
# include <unistd.h>
#endif
+
+#ifdef WNT
+#include <omnithread/pthread_nt.h>
+#endif
+
omni_mutex Logger::myLock;
/////////////////////////////////////////////////////////////////////
{
myLock.lock();
if (m_putIntoFile)
- m_outputFile << message << std::flush;
+#ifndef WNT
+ m_outputFile << message << std::flush;
+#else
+ m_outputFile << message << flush;
+#endif
else
std::cout << message;
myLock.unlock();
for (i = 1; i <= NumberOfTries; i++)
{
+#ifndef WNT
if (i != 1) nanosleep(&ts_req, &ts_rem);
+#else
+ if (i != 1) Sleep(TIMESleep / 1000000);
+#endif
try
{
obj = orb->resolve_initial_references("RootPOA") ;
{
std::cerr << "Caught unknown exception." << std::endl;
}
+ return 0;
}
#include <iostream>
using namespace std;
+#ifdef WNT
+#include <omnithread/pthread_nt.h>
+#endif
+
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
// searchin for naming service for 0.25*40=10 seconds
for (i = 1; i <= NumberOfTries; i++) {
+#ifndef WNT
if (i != 1) nanosleep(&ts_req,&ts_rem);
+#else
+ if (i != 1) Sleep(TIMESleep / 1000000);
+#endif
try{
if(CORBA::is_nil(obj))
obj = theOrb->resolve_initial_references("RootPOA");
name[0].id=CORBA::string_dup("Logger");
for(i = 1; i <= NumberOfTries; i++){
+#ifndef WNT
if (i != 1) nanosleep(&ts_req, &ts_rem);
+#else
+ if (i != 1) Sleep(TIMESleep / 1000000);
+#endif
try {
obj = inc->resolve(name);
if (!CORBA::is_nil(obj)) m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj);
// duplicate out Parameters
_length = S_in.ServiceoutParameter.length();
S_out.ServiceoutParameter.length(_length);
-
+
+#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+#else
+ for (ind2 = 0; ind2 < _length ; ind2 ++)
+#endif
duplicate(S_out.ServiceoutParameter[ind2],
S_in.ServiceoutParameter[ind2]);
// duplicate in DataStreamParameters
_length = S_in.ServiceinDataStreamParameter.length();
S_out.ServiceinDataStreamParameter.length(_length);
-
+
+#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+#else
+ for (ind2 = 0; ind2 < _length ; ind2 ++)
+#endif
duplicate(S_out.ServiceinDataStreamParameter[ind2],
S_in.ServiceinDataStreamParameter[ind2]);
if(MYDEBUG) SCRUTE(_length);
S_out.ServiceoutDataStreamParameter.length(_length);
+#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+#else
+ for (ind2 = 0; ind2 < _length ; ind2 ++)
+#endif
duplicate(S_out.ServiceoutDataStreamParameter[ind2],
S_in.ServiceoutDataStreamParameter[ind2]);
}
// The components in the general catalog are taken only if they're
// not defined in the personal catalog
+#ifndef WNT
for(unsigned int ind=0; ind < _general_module_list.size();ind++){
+#else
+ for(ind=0; ind < _general_module_list.size();ind++){
+#endif
_find = false;
for(unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++){
// searching if the component is already defined in
// The components in the general catalog are taken only if they're
// not defined in the personal catalog
+#ifndef WNT
for(unsigned int ind=0; ind < _general_module_list.size();ind++){
+#else
+ for(ind=0; ind < _general_module_list.size();ind++){
+#endif
_find = false;
for(unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++){
// searching if the component is aleready defined in
// The components in the general catalog are taken only if they're
// not defined in the personal catalog
+#ifndef WNT
for (unsigned int ind=0; ind < _general_module_list.size();ind++)
+#else
+ for (ind=0; ind < _general_module_list.size();ind++)
+#endif
{
_find = false;
// duplicate out Parameters
_length = S_parser.outParameters.size();
S_corba.ServiceoutParameter.length(_length);
-
+
+#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+#else
+ for (ind2 = 0; ind2 < _length ; ind2 ++)
+#endif
duplicate(S_corba.ServiceoutParameter[ind2],
S_parser.outParameters[ind2]);
// duplicate in DataStreamParameters
_length = S_parser.inDataStreamParameters.size();
S_corba.ServiceinDataStreamParameter.length(_length);
-
+
+#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+#else
+ for (ind2 = 0; ind2 < _length ; ind2 ++)
+#endif
duplicate(S_corba.ServiceinDataStreamParameter[ind2],
S_parser.inDataStreamParameters[ind2]);
_length = S_parser.outDataStreamParameters.size();
if(MYDEBUG) SCRUTE(_length);
S_corba.ServiceoutDataStreamParameter.length(_length);
-
+
+#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
+#else
+ for (ind2 = 0; ind2 < _length ; ind2 ++)
+#endif
duplicate(S_corba.ServiceoutDataStreamParameter[ind2],
S_parser.outDataStreamParameters[ind2]);
}
}
// Parse if a computer name is twice in the list of computers
+#ifndef WNT
for (unsigned int ind = 0; ind < _machine_list.size(); ind++)
+#else
+ for (ind = 0; ind < _machine_list.size(); ind++)
+#endif
{
for (unsigned int ind1 = ind+1 ; ind1 < _machine_list.size(); ind1++)
{
break; // server found, no more try to do
}
MESSAGE("Server "<< serverName <<" not yet ready, waiting...");
+#ifndef WNT
int a = nanosleep(&ts_req,&ts_rem); // wait before retry
+#else
+ Sleep(TIMESleep/1000000);
+#endif
}
}
catch( ServiceUnreachable& )
{
MESSAGE("CORBA::COMM_FAILURE: Naming Service not yet ready, waiting...");
+#ifndef WNT
int a = nanosleep(&ts_req,&ts_rem); // wait before retry
+#else
+ Sleep(TIMESleep/1000000);
+#endif
}
}
if (!found)
char* return_Path = new char[length_path +2];
return_Path[0] = '/' ;
return_Path[1] = '\0' ;
+#ifndef WNT
for (int k = 0 ; k <i ;k++)
+#else
+ for (k = 0 ; k <i ;k++)
+#endif
{
//SCRUTE(result_path[k])
strcat(return_Path,result_path[k]);
//class ServiceUnreachable;
#include "ServiceUnreachable.hxx"
-class SALOME_NamingService
+#if defined NAMINGSERVICE_EXPORTS
+#if defined WIN32
+#define NAMINGSERVICE_EXPORT __declspec( dllexport )
+#else
+#define NAMINGSERVICE_EXPORT
+#endif
+#else
+#if defined WNT
+#define NAMINGSERVICE_EXPORT __declspec( dllimport )
+#else
+#define NAMINGSERVICE_EXPORT
+#endif
+#endif
+
+class NAMINGSERVICE_EXPORT SALOME_NamingService
{
public:
//! default constructor
#include "NOTIFICATION_Supplier.hxx"
#include "NOTIFICATION_Consumer.hxx"
-char* NOTIFICATION_date();
-CosNA_EventChannel_ptr NOTIFICATION_channel();
+
+#if defined NOTIFICATION_EXPORTS
+#if defined WIN32
+#define NOTIFICATION_EXPORT __declspec( dllexport )
+#else
+#define NOTIFICATION_EXPORT
+#endif
+#else
+#if defined WNT
+#define NOTIFICATION_EXPORT __declspec( dllimport )
+#else
+#define NOTIFICATION_EXPORT
+#endif
+#endif
+
+NOTIFICATION_EXPORT char* NOTIFICATION_date();
+NOTIFICATION_EXPORT CosNA_EventChannel_ptr NOTIFICATION_channel();
#endif
#ifndef NOTIFICATION_Consumer_HXX
#define NOTIFICATION_Consumer_HXX
-class NOTIFICATION_Consumer: public POA_CosNotifyComm::StructuredPullConsumer {
+#if defined NOTIFICATION_EXPORTS
+#if defined WIN32
+#define NOTIFICATION_EXPORT __declspec( dllexport )
+#else
+#define NOTIFICATION_EXPORT
+#endif
+#else
+#if defined WNT
+#define NOTIFICATION_EXPORT __declspec( dllimport )
+#else
+#define NOTIFICATION_EXPORT
+#endif
+#endif
+
+class NOTIFICATION_EXPORT NOTIFICATION_Consumer: public POA_CosNotifyComm::StructuredPullConsumer {
public:
NOTIFICATION_Consumer();
virtual ~NOTIFICATION_Consumer();
#ifndef NOTIFICATION_Supplier_HXX
#define NOTIFICATION_Supplier_HXX
-class NOTIFICATION_Supplier: public POA_CosNotifyComm::StructuredPushSupplier {
+#if defined NOTIFICATION_EXPORTS
+#if defined WIN32
+#define NOTIFICATION_EXPORT __declspec( dllexport )
+#else
+#define NOTIFICATION_EXPORT
+#endif
+#else
+#if defined WNT
+#define NOTIFICATION_EXPORT __declspec( dllimport )
+#else
+#define NOTIFICATION_EXPORT
+#endif
+#endif
+
+class NOTIFICATION_EXPORT NOTIFICATION_Supplier: public POA_CosNotifyComm::StructuredPushSupplier {
public:
NOTIFICATION_Supplier(const char* instanceName, bool notif);
virtual ~NOTIFICATION_Supplier();
_VarComponents->remove( _Id ) ;
}
_Id = 0 ;
+#ifndef WNT
delete [] _Ior;
+#else
+ delete [] (char*) _Ior;
+#endif
_Ior = 0;
_SessionName = "";
_Name = "" ;
infos.pid = lesInfos.pid() ;
infos.machine = CORBA::string_dup( lesInfos.host_char() ) ;
infos.adip = CORBA::string_dup( lesInfos.adip() ) ;
- infos.uid = lesInfos.uid() ;
+ infos.uid = (long)lesInfos.uid() ;
infos.pwname = CORBA::string_dup( lesInfos.pwname() ) ;
infos.tc_start = lesInfos.start() ;
infos.tc_hello = 0 ;
#include CORBA_CLIENT_HEADER(SALOME_Registry)
#include <string>
-class RegistryConnexion
+#if defined REGISTRY_EXPORTS
+#if defined WIN32
+#define REGISTRY_EXPORT __declspec( dllexport )
+#else
+#define REGISTRY_EXPORT
+#endif
+#else
+#if defined WNT
+#define REGISTRY_EXPORT __declspec( dllimport )
+#else
+#define REGISTRY_EXPORT
+#endif
+#endif
+
+class REGISTRY_EXPORT RegistryConnexion
{
protected :
const char* _Ior ; // engine ior
# include <time.h>
}
+#ifndef WNT
#include <unistd.h>
+#endif
using namespace std;
/* ------------------------------*/
_Compteur = -1 ;
if ( _SessionName )
{
+#ifndef WNT
delete [] _SessionName ;
+#else
+ delete [] (char*)_SessionName ;
+#endif
_SessionName = 0 ;
}
END_OF("RegistryService::~RegistryService()") ;
#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
#include <string>
-class SALOME_LoadRateManager
+
+#if defined RESOURCESMANAGER_EXPORTS
+#if defined WIN32
+#define RESOURCESMANAGER_EXPORT __declspec( dllexport )
+#else
+#define RESOURCESMANAGER_EXPORT
+#endif
+#else
+#if defined WNT
+#define RESOURCESMANAGER_EXPORT __declspec( dllimport )
+#else
+#define RESOURCESMANAGER_EXPORT
+#endif
+#endif
+
+class RESOURCESMANAGER_EXPORT SALOME_LoadRateManager
{
public:
std::string FindBest(const Engines::MachineList& hosts);
#include <qdom.h>
#include <stdlib.h>
+#ifndef WNT
#include <unistd.h>
+#else
+#include <io.h>
+#include <process.h>
+#endif
#include <fstream>
#include <iostream>
#include <string.h>
return _dynamicResourcesSelecter.FindBest(listOfMachines);
}
+bool Engines_Container_i::isPythonContainer(const char* ContainerName)
+{
+ bool ret=false;
+ int len=strlen(ContainerName);
+ if(len>=2)
+ if(strcmp(ContainerName+len-2,"Py")==0)
+ ret=true;
+ return ret;
+}
+
+bool isPythonContainer(const char* ContainerName)
+{
+ bool ret=false;
+ int len=strlen(ContainerName);
+ if(len>=2)
+ if(strcmp(ContainerName+len-2,"Py")==0)
+ ret=true;
+ return ret;
+}
+
string SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer(const string& machine,const char *containerName)
{
_TmpFileName=BuildTemporaryFileName();
tempOutputFile << "source " << resInfo.PreReqFilePath << endl;
// ! env vars
tempOutputFile << (*(resInfo.ModulesPath.find("KERNEL"))).second << "/bin/salome/";
- if(Engines_Container_i::isPythonContainer(containerName))
+ if(isPythonContainer(containerName))
tempOutputFile << "SALOME_ContainerPy.py ";
else
tempOutputFile << "SALOME_Container ";
char *temp=new char[19];
strcpy(temp,"/tmp/command");
strcat(temp,"XXXXXX");
+#ifndef WNT
mkstemp(temp);
+#else
+ char aPID[80];
+ itoa(getpid(), aPID, 10);
+ strcat(temp,aPID);
+#endif
string command(temp);
delete [] temp;
command += ".sh";
#include <fstream>
#include <vector>
+
+
+#if defined RESOURCESMANAGER_EXPORTS
+#if defined WIN32
+#define RESOURCESMANAGER_EXPORT __declspec( dllexport )
+#else
+#define RESOURCESMANAGER_EXPORT
+#endif
+#else
+#if defined WNT
+#define RESOURCESMANAGER_EXPORT __declspec( dllimport )
+#else
+#define RESOURCESMANAGER_EXPORT
+#endif
+#endif
+
//WARNING the call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done in a critical section to be sure to be clean.
//Only one thread should use the SALOME_ResourcesManager class in a SALOME session.
-class SALOME_ResourcesManager
+class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager
{
public:
//! standard constructor
_machine_list.push_back(ressourceslist[ind].Parsername);
// Parse if a computer name is twice in the list of computers
+#ifndef WNT
for (unsigned int ind = 0; ind < _machine_list.size(); ind++)
+#else
+ for (ind = 0; ind < _machine_list.size(); ind++)
+#endif
{
for (unsigned int ind1 = ind+1 ; ind1 < _machine_list.size(); ind1++)
{
#define ABORT_MESS 1 // for traceType field in struct LocalTrace_TraceInfo
#define NORMAL_MESS 0
-struct LocalTrace_TraceInfo
+#if defined SALOMELOCALTRACE_EXPORTS
+#if defined WIN32
+#define SALOMELOCALTRACE_EXPORT __declspec( dllexport )
+#else
+#define SALOMELOCALTRACE_EXPORT
+#endif
+#else
+#if defined WNT
+#define SALOMELOCALTRACE_EXPORT __declspec( dllimport )
+#else
+#define SALOMELOCALTRACE_EXPORT
+#endif
+#endif
+
+
+
+struct SALOMELOCALTRACE_EXPORT LocalTrace_TraceInfo
{
char trace[MAX_TRACE_LENGTH];
pthread_t threadId;
int position; // to check sequence
};
-class LocalTraceBufferPool
+class SALOMELOCALTRACE_EXPORT LocalTraceBufferPool
{
public:
static LocalTraceBufferPool* instance();
LocalTraceCollector* LocalTraceCollector::_singleton = 0;
pthread_mutex_t LocalTraceCollector::_singletonMutex;
int LocalTraceCollector::_threadToClose = 0;
-pthread_t LocalTraceCollector::_threadId = 0; // used to control single run
+pthread_t* LocalTraceCollector::_threadId = 0; // used to control single run
int LocalTraceCollector::_toFile = 0;
std::string LocalTraceCollector::_fileName = "";
if (! _threadId) // only one run
{
isOKtoRun = 1;
- _threadId = pthread_self();
+ if(_threadId == 0) {
+ _threadId = new pthread_t;
+ }
+ *_threadId = pthread_self();
}
else cout << "----- Comment est-ce possible de passer la ? -------" <<endl;
ret = pthread_mutex_unlock(&_singletonMutex); // release lock
if (isOKtoRun)
{
- _threadId = pthread_self();
+ if(_threadId == 0) {
+ _threadId = new pthread_t;
+ }
+
+ *_threadId = pthread_self();
LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
LocalTrace_TraceInfo myTrace;
switch (_toFile)
{
case 1 : // --- trace to file
+#ifndef WNT
traceFile << "INTERRUPTION from thread " << myTrace.threadId
- << " : " << myTrace.trace;
+ << " : " << myTrace.trace;
+#else
+ traceFile << "INTERRUPTION from thread " << (void*)(&myTrace.threadId)
+ << " : " << myTrace.trace;
+#endif
traceFile.close();
// no break here !
case 0 : // --- trace to standard output
default : // --- on standard output, too
cout << flush ;
+#ifndef WNT
cerr << "INTERRUPTION from thread " << myTrace.threadId
<< " : " << myTrace.trace;
- cerr << flush ;
+#else
+ cerr << "INTERRUPTION from thread " << (void*)(&myTrace.threadId)
+ << " : " << myTrace.trace;
+#endif
+ cerr << flush ;
exit(1);
break;
}
switch (_toFile)
{
case 1 : // --- trace to file
- traceFile << "th. " << myTrace.threadId
+#ifndef WNT
+ traceFile << "th. " << myTrace.threadId
+ << " " << myTrace.trace;
+#else
+ traceFile << "th. " << (void*)(&myTrace.threadId)
<< " " << myTrace.trace;
+#endif
break;
case 0 : // --- trace to standard output
default : // --- on standard output, too
+#ifndef WNT
cout << "th. " << myTrace.threadId << " " << myTrace.trace;
+#else
+ cout << "th. " << (void*)(&myTrace.threadId) << " " << myTrace.trace;
+#endif
break;
}
}
if (_toFile==1) traceFile.close();
}
pthread_exit(NULL);
+ return NULL;
}
// ============================================================================
myTraceBuffer->insert(NORMAL_MESS,"end of trace "); //needed to wake up thread
if (_threadId)
{
- int ret = pthread_join(_threadId, NULL);
+ int ret = pthread_join(*_threadId, NULL);
if (ret) cout << "error close LocalTraceCollector : "<< ret << endl;
else cout << "LocalTraceCollector destruction OK" << endl;
}
//! See SALOMETraceCollector instead of LocalTraceCollector for SALOME usage
-class LocalTraceCollector
+class SALOMELOCALTRACE_EXPORT LocalTraceCollector
{
public:
static LocalTraceCollector* instance(int typeTrace=0);
static int _toFile;
static LocalTraceCollector* _singleton;
static pthread_mutex_t _singletonMutex;
- static pthread_t _threadId;
+ static pthread_t* _threadId;
static std::string _fileName;
};
#define INFOS(msg) {MESS_BEGIN("- Trace ") << msg << MESS_END}
#define PYSCRIPT(msg) {MESS_INIT("---PYSCRIPT--- ") << msg << MESS_END}
#define INTERRUPTION(msg) {MESS_BEGIN("- INTERRUPTION: ")<< msg << MESS_ABORT}
+#ifdef WNT
+#define IMMEDIATE_ABORT(code) {std::cout <<std::flush; \
+ std::cerr << "- ABORT " << __FILE__ << " [" <<__LINE__<< "] : " << flush; \
+ std::cerr << "ABORT return code= "<< code << std::endl; \
+ /*std::*/exit(code);}
+#else
#define IMMEDIATE_ABORT(code) {std::cout <<std::flush; \
std::cerr << "- ABORT " << __FILE__ << " [" <<__LINE__<< "] : " << flush; \
std::cerr << "ABORT return code= "<< code << std::endl; \
std::exit(code);}
+#endif
/* --- To print date and time of compilation of current source --- */
SALOMETraceCollector* SALOMETraceCollector::_singleton = 0;
pthread_mutex_t SALOMETraceCollector::_singletonMutex;
int SALOMETraceCollector::_threadToClose = 0;
-pthread_t SALOMETraceCollector::_threadId = 0; // used to control single run
+pthread_t* SALOMETraceCollector::_threadId = 0; // used to control single run
int SALOMETraceCollector::_toFile = 0;
std::string SALOMETraceCollector::_fileName = "";
CORBA::ORB_ptr SALOMETraceCollector::_orb = 0;
if (! _threadId) // only one run
{
isOKtoRun = 1;
- _threadId = pthread_self();
+ if(_threadId == 0) {
+ _threadId = new pthread_t;
+ }
+
+ *_threadId = pthread_self();
}
else cout << "----- Comment est-ce possible de passer la ? -------" <<endl;
ret = pthread_mutex_unlock(&_singletonMutex); // release lock
if (isOKtoRun)
{
- _threadId = pthread_self();
+ if(_threadId == 0) {
+ _threadId = new pthread_t;
+ }
+
+ *_threadId = pthread_self();
LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance();
LocalTrace_TraceInfo myTrace;
case 2 : // --- trace collection via CORBA
{
stringstream abortMessage("");
+#ifndef WNT
abortMessage << "INTERRUPTION from thread "
<< myTrace.threadId << " : " << myTrace.trace;
+#else
+ abortMessage << "INTERRUPTION from thread "
+ << (void*)&myTrace.threadId << " : " << myTrace.trace;
+#endif
CORBA::String_var LogMsg =
CORBA::string_dup(abortMessage.str().c_str());
m_pInterfaceLogger->putMessage(LogMsg);
}
break;
case 1 : // --- trace to file
+#ifndef WNT
traceFile << "INTERRUPTION from thread " << myTrace.threadId
+#else
+ traceFile << "INTERRUPTION from thread " << (void*)&myTrace.threadId
+#endif
<< " : " << myTrace.trace;
traceFile.close();
// no break here !
case 0 : // --- trace to standard output
default : // --- on standard output, too
cout << flush ;
+#ifndef WNT
cerr << "INTERRUPTION from thread " << myTrace.threadId
+#else
+ cerr << "INTERRUPTION from thread " << (void*)&myTrace.threadId
+#endif
<< " : " << myTrace.trace;
cerr << flush ;
exit(1);
case 2 : // --- trace collection via CORBA
{
stringstream aMessage("");
+#ifndef WNT
aMessage << "th. " << myTrace.threadId
+#else
+ aMessage << "th. " << (void*)&myTrace.threadId
+#endif
<< " " << myTrace.trace;
CORBA::String_var LogMsg =
CORBA::string_dup(aMessage.str().c_str());
}
break;
case 1 : // --- trace to file
+#ifndef WNT
traceFile << "th. " << myTrace.threadId
+#else
+ traceFile << "th. " << (void*)&myTrace.threadId
+#endif
<< " " << myTrace.trace;
break;
case 0 : // --- trace to standard output
default : // --- on standard output, too
+#ifndef WNT
cout << "th. " << myTrace.threadId << " " << myTrace.trace;
+#else
+ cout << "th. " << &myTrace.threadId << " " << myTrace.trace;
+#endif
break;
}
}
if (_toFile==1) traceFile.close();
}
pthread_exit(NULL);
+ return NULL;
}
// ============================================================================
myTraceBuffer->insert(NORMAL_MESS,"end of trace "); //needed to wake up thread
if (_threadId)
{
- int ret = pthread_join(_threadId, NULL);
+ int ret = pthread_join(*_threadId, NULL);
if (ret) cout << "error close SALOMETraceCollector : "<< ret << endl;
else cout << "SALOMETraceCollector destruction OK" << endl;
}
static int _toFile;
static SALOMETraceCollector* _singleton;
static pthread_mutex_t _singletonMutex;
- static pthread_t _threadId;
+ static pthread_t* _threadId;
static std::string _fileName;
static CORBA::ORB_ptr _orb;
};
#include <iostream>
#include <ctime>
+#ifdef WNT
+#include <omnithread/pthread_nt.h>
+#endif
+
using namespace std;
// ============================================================================
cout << "Caught exception: Naming Service can't found Logger";
}
}
+#ifndef WNT
int a = nanosleep(&ts_req,&ts_rem);
+#else
+ Sleep(TIMESleep / 1000000);
+#endif
cout << "TraceCollector_WaitForServerReadiness: retry look for"
<< serverName << endl;
}
#ifndef _OPUTIL_HXX
#define _OPUTIL_HXX
+#if defined UTILS_EXPORTS
+#if defined WIN32
+#define UTILS_EXPORT __declspec( dllexport )
+#else
+#define UTILS_EXPORT
+#endif
+#else
+#if defined WNT
+#define UTILS_EXPORT __declspec( dllimport )
+#else
+#define UTILS_EXPORT
+#endif
+#endif
+
#include <string>
-std::string GetHostname();
-const char *duplicate(const char * const);
+UTILS_EXPORT std::string GetHostname();
+UTILS_EXPORT const char *duplicate(const char * const);
#endif
# include "Utils_SALOME_Exception.hxx"
-class CommException : public SALOME_Exception
+class UTILS_EXPORT CommException : public SALOME_Exception
{
public :
CommException( void );
/*! \class ATEXIT_
*
- * Mécanisme pour faire exécuter une seule fois DESTRUCTEUR_GENERIQUE_::Nettoyage
- * à la fin du traitement : creation d'un singleton statique de l'objet
+ * M\89canisme pour faire ex\89cuter une seule fois DESTRUCTEUR_GENERIQUE_::Nettoyage
+ * \80 la fin du traitement : creation d'un singleton statique de l'objet
* tres specialise ATEXIT_.
*
- * La création d'un objet de type ATEXIT_ entraîne l'inscription de la fonction
- * Nettoyage() par atexit(). Il suffit donc de créer un singleton statique du type ATEXIT_
- * pour effectuer cet enregistrement une seule fois indépendament de l'utilisateur.
+ * La cr\89ation d'un objet de type ATEXIT_ entra\8ene l'inscription de la fonction
+ * Nettoyage() par atexit(). Il suffit donc de cr\89er un singleton statique du type ATEXIT_
+ * pour effectuer cet enregistrement une seule fois ind\89pendament de l'utilisateur.
*/
//CCRT
{
public :
/*!
- * Allocation dynamique de Destructeurs, une liste chaînée de DESTRUCTEUR_GENERIQUE_* et enregistrement
+ * Allocation dynamique de Destructeurs, une liste cha\8en\89e de DESTRUCTEUR_GENERIQUE_* et enregistrement
* de la fonction Nettoyage() par atexit().
*
- * La liste chaînée Destructeurs est détruite dans la fonction Nettoyage.
+ * La liste cha\8en\89e Destructeurs est d\89truite dans la fonction Nettoyage.
*/
//CCRT ATEXIT_( void )
ATEXIT_( bool Make_ATEXIT )
ASSERT (DESTRUCTEUR_GENERIQUE_::Destructeurs==0);
if(MYDEBUG) MESSAGE("Construction ATEXIT"); // message necessaire pour utiliser logger dans Nettoyage (cf.BUG KERNEL4561)
DESTRUCTEUR_GENERIQUE_::Destructeurs =
- new std::list<DESTRUCTEUR_GENERIQUE_*> ; // Destructeurs alloué dynamiquement (cf. ci-dessous) ,
- // il est utilisé puis détruit par la fonction Nettoyage
- int cr = atexit( Nettoyage ); // exécute Nettoyage lors de exit, après la destruction des données statiques !
+ new std::list<DESTRUCTEUR_GENERIQUE_*> ; // Destructeurs allou\89 dynamiquement (cf. ci-dessous) ,
+ // il est utilis\89 puis d\89truit par la fonction Nettoyage
+ int cr = atexit( Nettoyage ); // ex\89cute Nettoyage lors de exit, apr\88s la destruction des donn\89es statiques !
ASSERT(cr==0) ;
ATEXIT_Done = true ;
}
/*!
- * traitement effectué :
- * -# exécution de tous les objets de type DESTRUCTEUR_DE_ stockés dans la liste Destructeurs (ce qui détruit les
+ * traitement effectu\89 :
+ * -# ex\89cution de tous les objets de type DESTRUCTEUR_DE_ stock\89s dans la liste Destructeurs (ce qui d\89truit les
* singletons correspondant) ;
- * -# puis destruction de tous les objets de type DESTRUCTEUR_DE_ stockés dans la liste Destructeurs;
+ * -# puis destruction de tous les objets de type DESTRUCTEUR_DE_ stock\89s dans la liste Destructeurs;
* -# destruction de la liste Destructeurs.
*/
#ifndef WNT
const struct utsname &Identity::hostid(void) const
#else
- const char* const hostid(void) const
+ const char* const Identity::hostid(void) const
#endif
{
return _hostid ;
#endif
}
-class Identity
+#if defined UTILS_EXPORTS
+#if defined WIN32
+#define UTILS_EXPORT __declspec( dllexport )
+#else
+#define UTILS_EXPORT
+#endif
+#else
+#if defined WNT
+#define UTILS_EXPORT __declspec( dllimport )
+#else
+#define UTILS_EXPORT
+#endif
+#endif
+class UTILS_EXPORT Identity
{
protected :
void Utils_Mutex::lock()
{
pthread_mutex_lock( &myHelperMutex );
-
+
+#ifndef WNT
if ( myCount > 0 && myThread == pthread_self() ) {
+#else
+ if ( myCount > 0 && myThread.p == pthread_self().p ) {
+#endif
myCount++;
}
else {
void Utils_Mutex::unlock()
{
pthread_mutex_lock( &myHelperMutex );
-
+
+#ifndef WNT
if ( myThread == pthread_self() ) {
+#else
+ if ( myThread.p == pthread_self().p ) {
+#endif
if ( myCount && (--myCount) < 1 ) {
myCount = 0;
pthread_mutex_unlock( &myMutex );
#include <pthread.h>
-class Utils_Mutex
+#if defined UTILS_EXPORTS
+#if defined WIN32
+#define UTILS_EXPORT __declspec( dllexport )
+#else
+#define UTILS_EXPORT
+#endif
+#else
+#if defined WNT
+#define UTILS_EXPORT __declspec( dllimport )
+#else
+#define UTILS_EXPORT
+#endif
+#endif
+
+class UTILS_EXPORT Utils_Mutex
{
public:
Utils_Mutex();
int myCount;
};
-class Utils_Locker
+class UTILS_EXPORT Utils_Locker
{
public:
Utils_Locker( Utils_Mutex* );
#include "Utils_CommException.hxx"
+#if defined UTILS_EXPORTS
+#if defined WIN32
+#define UTILS_EXPORT __declspec( dllexport )
+#else
+#define UTILS_EXPORT
+#endif
+#else
+#if defined WNT
+#define UTILS_EXPORT __declspec( dllimport )
+#else
+#define UTILS_EXPORT
+#endif
+#endif
+
/*!
* Ce composant prend en charge la connexion et la deconnexion a l'orb
* Il est souhaitable de l'utiliser dans un SINGLETON.
*/
-class ORB_INIT
+class UTILS_EXPORT ORB_INIT
{
private :
#include <iostream>
#include "Utils_SALOME_Exception.hxx"
#include "utilities.h"
+
+#ifndef WNT
extern "C"
{
+#endif
#include <math.h>
#include <stdio.h>
#include <string.h>
+#ifndef WNT
}
+#endif
const char* duplicate( const char *const str ) ;
# define LOCALIZED(message) #message , __FILE__ , __LINE__
+#if defined UTILS_EXPORTS
+#if defined WIN32
+#define UTILS_EXPORT __declspec( dllexport )
+#else
+#define UTILS_EXPORT
+#endif
+#else
+#if defined WNT
+#define UTILS_EXPORT __declspec( dllimport )
+#else
+#define UTILS_EXPORT
+#endif
+#endif
-class SALOME_Exception : public std::exception
+class UTILS_EXPORT SALOME_Exception : public std::exception
{
private :
#define _UTILS_SIGNALSHANDLER_H_
+#if defined UTILS_EXPORTS
+#if defined WIN32
+#define UTILS_EXPORT __declspec( dllexport )
+#else
+#define UTILS_EXPORT
+#endif
+#else
+#if defined WNT
+#define UTILS_EXPORT __declspec( dllimport )
+#else
+#define UTILS_EXPORT
+#endif
+#endif
+
#include <map>
typedef void (*TSigHandler)(int);
-class Utils_SignalsHandler{
+class UTILS_EXPORT Utils_SignalsHandler{
public:
Utils_SignalsHandler();
~Utils_SignalsHandler();
};
-class Utils_CASSignalsHandler: private Utils_SignalsHandler{
+class UTILS_EXPORT Utils_CASSignalsHandler: private Utils_SignalsHandler{
public:
Utils_CASSignalsHandler();
};
#include <string.h>
}
#include "utilities.h"
+#include "OpUtil.hxx"
using namespace std;