mirror of
https://github.com/boostorg/regex.git
synced 2025-07-23 17:17:22 +02:00
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
|
||||
|
||||
#if (defined(_REENTRANT) || defined(_PTHREADS)) && !defined(_NOTHREADS)
|
||||
#if (defined(_REENTRANT) || defined(_PTHREADS) || defined(__BEOS__)) && !defined(_NOTHREADS)
|
||||
//
|
||||
// Several compilers define _REENTRANT or
|
||||
// _PTHREADS when threading support is turned on:
|
||||
@ -967,7 +967,7 @@ public:
|
||||
#undef wcsxfrm
|
||||
#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,
|
||||
// note that we almost always do this for STLPort, as it doesn't always
|
||||
|
@ -33,9 +33,14 @@
|
||||
#include <windows.h>
|
||||
#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>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost{
|
||||
@ -51,6 +56,35 @@ void BOOST_RE_CALL re_free_threads();
|
||||
#ifdef BOOST_RE_THREADS
|
||||
|
||||
#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;
|
||||
|
||||
@ -73,7 +107,7 @@ inline void BOOST_RE_CALL LeaveCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_unlock(ps);
|
||||
}
|
||||
|
||||
#endif // __BEOS__
|
||||
#endif
|
||||
|
||||
template <class Lock>
|
||||
@ -136,7 +170,7 @@ public:
|
||||
typedef lock_guard<critical_section> ro_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&)
|
||||
|
Reference in New Issue
Block a user