~clint-fewbar/ubuntu/precise/erlang/merge-15b

« back to all changes in this revision

Viewing changes to erts/include/internal/win/ethr_event.h

  • Committer: Package Import Robot
  • Author(s): Sergei Golovan
  • Date: 2011-12-15 19:20:10 UTC
  • mfrom: (1.1.18) (3.5.15 sid)
  • mto: (3.5.16 sid)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20111215192010-jnxcfe3tbrpp0big
Tags: 1:15.b-dfsg-1
* New upstream release.
* Upload to experimental because this release breaks external drivers
  API along with ABI, so several applications are to be fixed.
* Removed SSL patch because the old SSL implementation is removed from
  the upstream distribution.
* Removed never used patch which added native code to erlang beam files.
* Removed the erlang-docbuilder binary package because the docbuilder
  application was dropped by upstream.
* Documented dropping ${erlang-docbuilder:Depends} substvar in
  erlang-depends(1) manpage.
* Made erlang-base and erlang-base-hipe provide virtual package
  erlang-abi-15.b (the number means the first erlang version, which
  provides current ABI).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * %CopyrightBegin%
3
3
 *
4
 
 * Copyright Ericsson AB 2009-2010. All Rights Reserved.
 
4
 * Copyright Ericsson AB 2009-2011. All Rights Reserved.
5
5
 *
6
6
 * The contents of this file are subject to the Erlang Public License,
7
7
 * Version 1.1, (the "License"); you may not use this file except in
21
21
 * Author: Rickard Green
22
22
 */
23
23
 
24
 
#define ETHR_EVENT_OFF_WAITER__         ((LONG) -1)
25
 
#define ETHR_EVENT_OFF__                ((LONG) 1)
26
 
#define ETHR_EVENT_ON__                 ((LONG) 0)
 
24
#define ETHR_EVENT_OFF_WAITER__         ((ethr_sint32_t) -1)
 
25
#define ETHR_EVENT_OFF__                ((ethr_sint32_t) 1)
 
26
#define ETHR_EVENT_ON__                 ((ethr_sint32_t) 0)
27
27
 
28
28
typedef struct {
29
 
    volatile LONG state;
 
29
    ethr_atomic32_t state;
30
30
    HANDLE handle;
31
31
} ethr_event;
32
32
 
33
33
#if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_EVENT_IMPL__)
34
34
 
 
35
#pragma intrinsic(_InterlockedExchange)
 
36
 
35
37
static ETHR_INLINE void
36
38
ETHR_INLINE_FUNC_NAME_(ethr_event_set)(ethr_event *e)
37
39
{
38
 
    /* InterlockedExchange() imply a full memory barrier which is important */
39
 
    LONG state = InterlockedExchange(&e->state, ETHR_EVENT_ON__);
 
40
    /* _InterlockedExchange() imply a full memory barrier which is important */
 
41
    ethr_sint32_t state = ethr_atomic32_xchg_wb(&e->state, ETHR_EVENT_ON__);
40
42
    if (state == ETHR_EVENT_OFF_WAITER__) {
41
43
        if (!SetEvent(e->handle))
42
44
            ETHR_FATAL_ERROR__(ethr_win_get_errno__());
46
48
static ETHR_INLINE void
47
49
ETHR_INLINE_FUNC_NAME_(ethr_event_reset)(ethr_event *e)
48
50
{
49
 
    /* InterlockedExchange() imply a full memory barrier which is important */
50
 
    InterlockedExchange(&e->state, ETHR_EVENT_OFF__);
 
51
    ethr_atomic32_set(&e->state, ETHR_EVENT_OFF__);
 
52
    ETHR_MEMORY_BARRIER;
51
53
}
52
54
 
53
55
#endif