forked from boostorg/regex
Added BeOS threading support, tweeked STLPort detection.
[SVN r10235]
This commit is contained in:
@ -307,7 +307,7 @@ full list of macros and their usage.
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(_REENTRANT) || defined(_PTHREADS)) && !defined(_NOTHREADS)
|
#if (defined(_REENTRANT) || defined(_PTHREADS) || defined(__BEOS__)) && !defined(_NOTHREADS)
|
||||||
//
|
//
|
||||||
// Several compilers define _REENTRANT or
|
// Several compilers define _REENTRANT or
|
||||||
// _PTHREADS when threading support is turned on:
|
// _PTHREADS when threading support is turned on:
|
||||||
@ -967,7 +967,7 @@ public:
|
|||||||
#undef wcsxfrm
|
#undef wcsxfrm
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BOOST_NO_STDC_NAMESPACE) || (defined(std) && defined(__SGI_STL_PORT))
|
#if defined(BOOST_NO_STDC_NAMESPACE) || (defined(std) && defined(__SGI_STL_PORT)) || defined(_STLP_IMPORT_VENDOR_CSTD) || defined(__STL_IMPORT_VENDOR_CSTD)
|
||||||
//
|
//
|
||||||
// fix namespaces,
|
// fix namespaces,
|
||||||
// note that we almost always do this for STLPort, as it doesn't always
|
// note that we almost always do this for STLPort, as it doesn't always
|
||||||
|
@ -33,9 +33,14 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(BOOST_RE_PLATFORM_W32) && defined(BOOST_RE_THREADS)
|
#if !defined(BOOST_RE_PLATFORM_W32) && defined(BOOST_RE_THREADS)
|
||||||
|
#if defined(__BEOS__)
|
||||||
|
#include <OS.h>
|
||||||
|
#include <cassert>
|
||||||
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace boost{
|
namespace boost{
|
||||||
@ -51,6 +56,35 @@ void BOOST_RE_CALL re_free_threads();
|
|||||||
#ifdef BOOST_RE_THREADS
|
#ifdef BOOST_RE_THREADS
|
||||||
|
|
||||||
#ifndef BOOST_RE_PLATFORM_W32
|
#ifndef BOOST_RE_PLATFORM_W32
|
||||||
|
#ifdef __BEOS__
|
||||||
|
|
||||||
|
typedef sem_id CRITICAL_SECTION;
|
||||||
|
|
||||||
|
inline void BOOST_RE_CALL InitializeCriticalSection(CRITICAL_SECTION* ps)
|
||||||
|
{
|
||||||
|
*ps = create_sem(1, "regex++");
|
||||||
|
assert(*ps > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void BOOST_RE_CALL DeleteCriticalSection(CRITICAL_SECTION* ps)
|
||||||
|
{
|
||||||
|
int t = delete_sem(*ps);
|
||||||
|
assert(t == B_NO_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void BOOST_RE_CALL EnterCriticalSection(CRITICAL_SECTION* ps)
|
||||||
|
{
|
||||||
|
status_t t = acquire_sem(*ps);
|
||||||
|
assert(t == B_NO_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void BOOST_RE_CALL LeaveCriticalSection(CRITICAL_SECTION* ps)
|
||||||
|
{
|
||||||
|
status_t t = release_sem(*ps);
|
||||||
|
assert(t == B_NO_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // __BEOS__
|
||||||
|
|
||||||
typedef pthread_mutex_t CRITICAL_SECTION;
|
typedef pthread_mutex_t CRITICAL_SECTION;
|
||||||
|
|
||||||
@ -73,7 +107,7 @@ inline void BOOST_RE_CALL LeaveCriticalSection(CRITICAL_SECTION* ps)
|
|||||||
{
|
{
|
||||||
pthread_mutex_unlock(ps);
|
pthread_mutex_unlock(ps);
|
||||||
}
|
}
|
||||||
|
#endif // __BEOS__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <class Lock>
|
template <class Lock>
|
||||||
@ -136,7 +170,7 @@ public:
|
|||||||
typedef lock_guard<critical_section> ro_guard;
|
typedef lock_guard<critical_section> ro_guard;
|
||||||
typedef lock_guard<critical_section> rw_guard;
|
typedef lock_guard<critical_section> rw_guard;
|
||||||
|
|
||||||
friend lock_guard<critical_section>;
|
friend class lock_guard<critical_section>;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool BOOST_RE_CALL operator==(const critical_section&, const critical_section&)
|
inline bool BOOST_RE_CALL operator==(const critical_section&, const critical_section&)
|
||||||
|
Reference in New Issue
Block a user