blob: ba31295e41eff39334e7de3ef2e535ca969373f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// { dg-do compile }
typedef __SIZE_TYPE__ size_t;
void* __cxa_allocate_exception(size_t) throw();
typedef struct { } __gthread_mutex_t;
extern int __gthr_win32_mutex_unlock (__gthread_mutex_t *);
int __gthread_mutex_lock (__gthread_mutex_t *__mutex);
int __gthread_mutex_unlock (__gthread_mutex_t *__mutex);
void __throw_concurrence_lock_error();
void __throw_concurrence_unlock_error();
class __mutex {
__gthread_mutex_t _M_mutex;
public:
void lock() {
if (__gthread_mutex_lock(&_M_mutex) != 0)
__throw_concurrence_lock_error();
}
void unlock() {
if (__gthread_mutex_unlock(&_M_mutex) != 0)
__throw_concurrence_unlock_error();
}
};
class __scoped_lock {
typedef __mutex __mutex_type;
__mutex_type& _M_device;
public:
explicit __scoped_lock(__mutex_type& __name) : _M_device(__name) {
_M_device.lock();
}
~__scoped_lock() throw() {
_M_device.unlock();
}
};
__mutex emergency_mutex;
void * __cxa_allocate_exception(size_t thrown_size) throw()
{
void *ret;
if (! ret)
__scoped_lock sentry(emergency_mutex);
}
|