Dali 3D User Interface Engine
atomics.h
Go to the documentation of this file.
1 #ifndef _DALI_INTERNAL_PLATFORM_ATOMICS_H_
2 #define _DALI_INTERNAL_PLATFORM_ATOMICS_H_
3 
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 /*
22  * atomics.h
23  *
24  * Interface for atomic memory operations.
25  * There may be platform-specific versions of this file in other directories.
26  */
27 
28 namespace Dali
29 {
30 namespace Internal
31 {
32 
46 inline void AtomicWriteToCacheableAlignedAddress( volatile uint32_t * const address, const uint32_t value )
47 {
48  DALI_ASSERT_DEBUG( ptrdiff_t(address) % 4 == 0 && "Address must be 32 bit aligned" );
49  *address = value;
50 }
51 
64 inline uint32_t AtomicReadFromCacheableAlignedAddress( const volatile uint32_t * const address )
65 {
66  DALI_ASSERT_DEBUG( ptrdiff_t(address) % 4 == 0 && "Address must be 32 bit aligned" );
67  return *address;
68 }
69 
70 } /* namespace Internal */
71 } /* namespace Dali */
72 
73 #endif /* _DALI_INTERNAL_PLATFORM_ATOMICS_H_ */
Dali Docs Home
Read more about Dali