Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
c-utility/pal/windows/refcount_os.h@0:f7f1f0d76dd6, 2018-08-23 (annotated)
- Committer:
- XinZhangMS
- Date:
- Thu Aug 23 06:52:14 2018 +0000
- Revision:
- 0:f7f1f0d76dd6
azure-c-sdk for mbed os supporting NUCLEO_F767ZI
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
XinZhangMS | 0:f7f1f0d76dd6 | 1 | // Copyright (c) Microsoft. All rights reserved. |
XinZhangMS | 0:f7f1f0d76dd6 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
XinZhangMS | 0:f7f1f0d76dd6 | 3 | |
XinZhangMS | 0:f7f1f0d76dd6 | 4 | // This file gets included into refcount.h as a means of extending the behavior of |
XinZhangMS | 0:f7f1f0d76dd6 | 5 | // atomic increment, decrement, and test. |
XinZhangMS | 0:f7f1f0d76dd6 | 6 | |
XinZhangMS | 0:f7f1f0d76dd6 | 7 | // The first phase defines COUNT_TYPE |
XinZhangMS | 0:f7f1f0d76dd6 | 8 | #ifndef REFCOUNT_OS_H__WINDOWS |
XinZhangMS | 0:f7f1f0d76dd6 | 9 | #define REFCOUNT_OS_H__WINDOWS |
XinZhangMS | 0:f7f1f0d76dd6 | 10 | |
XinZhangMS | 0:f7f1f0d76dd6 | 11 | #include "windows.h" |
XinZhangMS | 0:f7f1f0d76dd6 | 12 | // The Windows atomic operations work on LONG |
XinZhangMS | 0:f7f1f0d76dd6 | 13 | #define COUNT_TYPE LONG |
XinZhangMS | 0:f7f1f0d76dd6 | 14 | |
XinZhangMS | 0:f7f1f0d76dd6 | 15 | /*if macro DEC_REF returns DEC_RETURN_ZERO that means the ref count has reached zero.*/ |
XinZhangMS | 0:f7f1f0d76dd6 | 16 | #define DEC_RETURN_ZERO (0) |
XinZhangMS | 0:f7f1f0d76dd6 | 17 | #define INC_REF(type, var) InterlockedIncrement(&(((REFCOUNT_TYPE(type)*)var)->count)) |
XinZhangMS | 0:f7f1f0d76dd6 | 18 | #define DEC_REF(type, var) InterlockedDecrement(&(((REFCOUNT_TYPE(type)*)var)->count)) |
XinZhangMS | 0:f7f1f0d76dd6 | 19 | #define INIT_REF(type, var) InterlockedExchange(&(((REFCOUNT_TYPE(type)*)var)->count), 1) |
XinZhangMS | 0:f7f1f0d76dd6 | 20 | |
XinZhangMS | 0:f7f1f0d76dd6 | 21 | #endif // REFCOUNT_OS_H__WINDOWS |