~ubuntu-branches/ubuntu/karmic/apache2/karmic-security

« back to all changes in this revision

Viewing changes to srclib/apr/atomic/win32/apr_atomic.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Fritsch
  • Date: 2008-10-01 11:50:18 UTC
  • mfrom: (34 intrepid)
  • mto: (14.2.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 40.
  • Revision ID: james.westby@ubuntu.com-20081001115018-1022gw429ce4pqyp
Tags: 2.2.9-10
Regression fix from upstream svn for mod_proxy_http:
Don't trigger a retry by the client if a failure to read the response line
was the result of a timeout.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
2
 
 * applicable.
3
 
 *
4
 
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 
 * you may not use this file except in compliance with the License.
6
 
 * You may obtain a copy of the License at
 
1
/* Licensed to the Apache Software Foundation (ASF) under one or more
 
2
 * contributor license agreements.  See the NOTICE file distributed with
 
3
 * this work for additional information regarding copyright ownership.
 
4
 * The ASF licenses this file to You under the Apache License, Version 2.0
 
5
 * (the "License"); you may not use this file except in compliance with
 
6
 * the License.  You may obtain a copy of the License at
7
7
 *
8
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
9
 *
38
38
typedef WINBASEAPI void * (WINAPI * apr_atomic_win32_ptr_ptr_ptr_fn)
39
39
    (volatile void **, 
40
40
     void *, const void *);
 
41
typedef WINBASEAPI void * (WINAPI * apr_atomic_win32_ptr_ptr_fn)
 
42
    (volatile void **,
 
43
     void *);
41
44
 
42
45
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
43
46
{
44
47
#if (defined(_M_IA64) || defined(_M_AMD64))
45
48
    return InterlockedExchangeAdd(mem, val);
 
49
#elif defined(__MINGW32__)
 
50
    return InterlockedExchangeAdd((long *)mem, val);
46
51
#else
47
52
    return ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, val);
48
53
#endif
55
60
{
56
61
#if (defined(_M_IA64) || defined(_M_AMD64))
57
62
    InterlockedExchangeAdd(mem, -val);
 
63
#elif defined(__MINGW32__)
 
64
    InterlockedExchangeAdd((long *)mem, -val);
58
65
#else
59
66
    ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, -val);
60
67
#endif
65
72
    /* we return old value, win32 returns new value :( */
66
73
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
67
74
    return InterlockedIncrement(mem) - 1;
 
75
#elif defined(__MINGW32__)
 
76
    return InterlockedIncrement((long *)mem) - 1;
68
77
#else
69
78
    return ((apr_atomic_win32_ptr_fn)InterlockedIncrement)(mem) - 1;
70
79
#endif
74
83
{
75
84
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
76
85
    return InterlockedDecrement(mem);
 
86
#elif defined(__MINGW32__)
 
87
    return InterlockedDecrement((long *)mem);
77
88
#else
78
89
    return ((apr_atomic_win32_ptr_fn)InterlockedDecrement)(mem);
79
90
#endif
83
94
{
84
95
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
85
96
    InterlockedExchange(mem, val);
 
97
#elif defined(__MINGW32__)
 
98
    InterlockedExchange((long*)mem, val);
86
99
#else
87
100
    ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val);
88
101
#endif
98
111
{
99
112
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
100
113
    return InterlockedCompareExchange(mem, with, cmp);
 
114
#elif defined(__MINGW32__)
 
115
    return InterlockedCompareExchange((long*)mem, with, cmp);
101
116
#else
102
117
    return ((apr_atomic_win32_ptr_val_val_fn)InterlockedCompareExchange)(mem, with, cmp);
103
118
#endif
106
121
APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
107
122
{
108
123
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
109
 
    return InterlockedCompareExchangePointer(mem, with, cmp);
 
124
    return InterlockedCompareExchangePointer((void* volatile*)mem, with, (void*)cmp);
 
125
#elif defined(__MINGW32__)
 
126
    return InterlockedCompareExchangePointer((void**)mem, with, (void*)cmp);
110
127
#else
111
128
    /* Too many VC6 users have stale win32 API files, stub this */
112
129
    return ((apr_atomic_win32_ptr_ptr_ptr_fn)InterlockedCompareExchange)(mem, with, cmp);
117
134
{
118
135
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
119
136
    return InterlockedExchange(mem, val);
 
137
#elif defined(__MINGW32__)
 
138
    return InterlockedExchange((long *)mem, val);
120
139
#else
121
140
    return ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val);
122
141
#endif
123
142
}
 
143
 
 
144
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
 
145
{
 
146
#if (defined(_M_IA64) || defined(_M_AMD64) || defined(__MINGW32__)) && !defined(RC_INVOKED)
 
147
    return InterlockedExchangePointer((void**)mem, with);
 
148
#else
 
149
    /* Too many VC6 users have stale win32 API files, stub this */
 
150
    return ((apr_atomic_win32_ptr_ptr_fn)InterlockedExchange)(mem, with);
 
151
#endif
 
152
}