Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
6abeb7ec
Commit
6abeb7ec
authored
Aug 11, 2017
by
Constantin Rack
Committed by
GitHub
Aug 11, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2675 from bluca/sunos_sigbus
Problem SIGBUS under 64-bit SunOS Sparc
parents
347f143a
e376c81c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
atomic_counter.hpp
src/atomic_counter.hpp
+22
-2
atomic_ptr.hpp
src/atomic_ptr.hpp
+1
-1
No files found.
src/atomic_counter.hpp
View file @
6abeb7ec
...
...
@@ -36,7 +36,7 @@
#define ZMQ_ATOMIC_COUNTER_MUTEX
#elif defined ZMQ_HAVE_ATOMIC_INTRINSICS
#define ZMQ_ATOMIC_COUNTER_INTRINSIC
#elif (defined
ZMQ_CXX11 && defined
__cplusplus && __cplusplus >= 201103L)
#elif (defined __cplusplus && __cplusplus >= 201103L)
#define ZMQ_ATOMIC_COUNTER_CXX11
#elif (defined __i386__ || defined __x86_64__) && defined __GNUC__
#define ZMQ_ATOMIC_COUNTER_X86
...
...
@@ -69,8 +69,22 @@ namespace zmq
// This class represents an integer that can be incremented/decremented
// in atomic fashion.
//
// In zmq::shared_message_memory_allocator a buffer with an atomic_counter_t
// at the start is allocated. If the class does not align to pointer size,
// access to pointers in structures in the buffer will cause SIGBUS on
// architectures that do not allow mis-aligned pointers (eg: SPARC).
// Force the compiler to align to pointer size, which will cause the object
// to grow from 4 bytes to 8 bytes on 64 bit architectures (when not using
// mutexes).
#if defined (_MSC_VER) && (defined (_M_X64) || defined (_M_ARM64))
class
__declspec
(
align
(
8
))
atomic_counter_t
#elif defined (_MSC_VER) && (defined (_M_IX86) || defined (_M_ARM_ARMV7VE))
class
__declspec
(
align
(
4
))
atomic_counter_t
#else
class
atomic_counter_t
#endif
{
public
:
...
...
@@ -212,7 +226,13 @@ namespace zmq
atomic_counter_t
(
const
atomic_counter_t
&
);
const
atomic_counter_t
&
operator
=
(
const
atomic_counter_t
&
);
#endif
#if defined (__GNUC__) || defined ( __INTEL_COMPILER) || \
(defined (__SUNPRO_C) && __SUNPRO_C >= 0x590) || \
(defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x590)
}
__attribute__
((
aligned
(
sizeof
(
void
*
))));
#else
};
#endif
}
...
...
src/atomic_ptr.hpp
View file @
6abeb7ec
...
...
@@ -34,7 +34,7 @@
#define ZMQ_ATOMIC_PTR_MUTEX
#elif defined ZMQ_HAVE_ATOMIC_INTRINSICS
#define ZMQ_ATOMIC_PTR_INTRINSIC
#elif (defined
ZMQ_CXX11 && defined
__cplusplus && __cplusplus >= 201103L)
#elif (defined __cplusplus && __cplusplus >= 201103L)
#define ZMQ_ATOMIC_PTR_CXX11
#elif (defined __i386__ || defined __x86_64__) && defined __GNUC__
#define ZMQ_ATOMIC_PTR_X86
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment