/** Infrastructure common to VOCAL.
*/
namespace Vocal
{
/** Infrastructure common to VOCAL to create and manage threads.
*/
namespace Threads
{
/** Defines a simple mutex class which provides 'fast' mutex functionality,
* meaning that if the calling thread already has the mutex locked, a call
* to lock will block the thread forever.
*/
class Mutex : public Lockable
{
public:
/** Create a VMutex object initialized with operating system
* dependent defaults (if any).
*/
Mutex();
/**
** Delete a VMutex object
*/
virtual ~Mutex();
/** Lock the mutex. If the mutex is currently unlocked, it
* becomes locked and owned by the calling thread, and
* lock returns immediately. If the mutex is already locked by
* another thread, lock suspends the calling thread until the
* mutex is unlocked. If the mutex is already locked by the calling
* thread, the calling thread blocks forever.
*/
virtual void lock();
/** Unlock the mutex. The mutex is assumed to be locked and owned
* by the calling thread, meaning that a call to unlock always
* returns it to the unlocked state.
*/
virtual void unlock();
/** Returns the operating system dependent unique id of the mutex.
*/
vmutex_t * getId() const;
[^] # Re: plus de renseignements ?
Posté par moule2005 . En réponse au message erreur compil Mutex. Évalué à 1.
Sinon:
----------------------------------------------------------
MUTEX.HXX:
#if !defined(VOCAL_MUTEX_HXX)
#define VOCAL_MUTEX_HXX
static const char* const Mutex_hxx_Version =
"$Id: Mutex.hxx,v 1.2 2001年03月23日 20:22:41 icahoon Exp $";
#include "global.h"
#include "vthread.h"
#include "Lockable.hxx"
/** Infrastructure common to VOCAL.
*/
namespace Vocal
{
/** Infrastructure common to VOCAL to create and manage threads.
*/
namespace Threads
{
/** Defines a simple mutex class which provides 'fast' mutex functionality,
* meaning that if the calling thread already has the mutex locked, a call
* to lock will block the thread forever.
*/
class Mutex : public Lockable
{
public:
/** Create a VMutex object initialized with operating system
* dependent defaults (if any).
*/
Mutex();
/**
** Delete a VMutex object
*/
virtual ~Mutex();
/** Lock the mutex. If the mutex is currently unlocked, it
* becomes locked and owned by the calling thread, and
* lock returns immediately. If the mutex is already locked by
* another thread, lock suspends the calling thread until the
* mutex is unlocked. If the mutex is already locked by the calling
* thread, the calling thread blocks forever.
*/
virtual void lock();
/** Unlock the mutex. The mutex is assumed to be locked and owned
* by the calling thread, meaning that a call to unlock always
* returns it to the unlocked state.
*/
virtual void unlock();
/** Returns the operating system dependent unique id of the mutex.
*/
vmutex_t * getId() const;
private:
mutable vmutex_t myId ;
};
} // namespace Threads
} // namespace Vocal
#endif // !defined(VOCAL_MUTEX_HXX)
----------------------------------------------------------------------------------
MUTEX.CXX
static const char* const Mutex_cxx_Version =
"$Id: Mutex.cxx,v 1.2 2001年08月10日 04:02:08 icahoon Exp $";
#include "Mutex.hxx"
#include "global.h"
#include
#include
#include
using Vocal::Threads::Mutex;
using Vocal::ReturnCode;
using Vocal::SUCCESS;
Mutex::Mutex()
{
myId = PTHREAD_MUTEX_INITIALIZER ;
ReturnCode rc = vmutex_init(&myId);
assert( rc != EINVAL);
assert( rc != EBUSY);
assert( rc != ENOMEM);
assert( rc != EAGAIN);
assert( rc == SUCCESS );
}
Mutex::~Mutex ()
{
ReturnCode rc = vmutex_destroy(&myId);
assert( rc != EBUSY ); // currently locked
assert( rc == SUCCESS );
}
void
Mutex::lock()
{
ReturnCode rc = vmutex_lock(&myId);
assert( rc != EINVAL );
assert( rc != EDEADLK );
assert( rc == SUCCESS );
}
void
Mutex::unlock()
{
ReturnCode rc = vmutex_unlock(&myId);
assert( rc != EINVAL );
assert( rc != EPERM );
assert( rc == SUCCESS );
}
vmutex_t *
Mutex::getId() const
{
return ( &myId );
}
--------------------------------------------------------------------------
GLOBAL.H
#ifndef GLOBAL_H_
#define GLOBAL_H_
$Id: global.h,v 1.8 2001年08月16日 20:07:16 icahoon Exp $
*/
#ifdef USE_DMALLOC
#include <dmalloc.h>
#endif
#ifdef __sgi
#include <pthread.h>
#include
#endif
#ifdef __cplusplus
namespace std {
};
using namespace std;
#endif
/* this is used to turn of unused warnings in GCC */
#ifdef __GNUC__
#define UNUSED_VARIABLE __attribute__((__unused__))
#else
#define UNUSED_VARIABLE
#endif
#if defined(WIN32)
#if _MSC_VER > 1000
#pragma once
#endif /* _MSC_VER > 1000 */
#pragma warning(disable : 4786)
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <direct.h>
#include
#include
#include
#include <process.h>
#define srandom srand
#define random rand
#define strcasecmp stricmp
#define strncasecmp strnicmp
#define EWOULDBLOCK WSAEWOULDBLOCK
#define EINPROGRESS WSAEINPROGRESS
#define EALREADY WSAEALREADY
#define ENOTSOCK WSAENOTSOCK
#define EDESTADDRREQ WSAEDESTADDRREQ
#define EMSGSIZE WSAEMSGSIZE
#define EPROTOTYPE WSAEPROTOTYPE
#define ENOPROTOOPT WSAENOPROTOOPT
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
#define EOPNOTSUPP WSAEOPNOTSUPP
#define EPFNOSUPPORT WSAEPFNOSUPPORT
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#define EADDRINUSE WSAEADDRINUSE
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
#define ENETDOWN WSAENETDOWN
#define ENETUNREACH WSAENETUNREACH
#define ENETRESET WSAENETRESET
#define ECONNABORTED WSAECONNABORTED
#define ECONNRESET WSAECONNRESET
#define ENOBUFS WSAENOBUFS
#define EISCONN WSAEISCONN
#define ENOTCONN WSAENOTCONN
#define ESHUTDOWN WSAESHUTDOWN
#define ETOOMANYREFS WSAETOOMANYREFS
#define ETIMEDOUT WSAETIMEDOUT
#define ECONNREFUSED WSAECONNREFUSED
#define ELOOP WSAELOOP
#define EHOSTDOWN WSAEHOSTDOWN
#define EHOSTUNREACH WSAEHOSTUNREACH
#define EPROCLIM WSAEPROCLIM
#define EUSERS WSAEUSERS
#define EDQUOT WSAEDQUOT
#define ESTALE WSAESTALE
#define EREMOTE WSAEREMOTE
#if !defined(MAXHOSTNAMELEN)
#define MAXHOSTNAMELEN 256
#endif /* !defined(MAXHOSTNAMELEN) */
typedef int sigset_t;
typedef int siginfo_t;
typedef int pid_t;
typedef unsigned long int in_addr_t;
typedef long off_t;
struct pollfd
{
int fd;
short int events;
short int revents;
};
#define POLLIN 0x001
#define POLLPRI 0x002
#define POLLOUT 0x004
#define POLLERR 0x008
#define POLLHUP 0x010
#define POLLNVAL 0x020
#define getcwd _getcwd
#endif /* defined(WIN32) */
#endif /* GLOBAL_H_ */
Voila, je n'arrive tjrs pas a voir ou pourrait etre le probleme!