AtomicCounter portability

A general discussion forum.
deisenhut
Posts: 11
Joined: 30 Jul 2013, 00:11

AtomicCounter portability

Postby deisenhut » 02 Aug 2013, 15:13

Looking at the Poco docs for AtomicCounter, it says:

The following platforms currently have atomic primitives:
Windows
Mac OS X
GCC 4.1+ (Intel platforms only)


The "Intel platforms only" for GCC concerns me. I'm converting an existing WinCE application (ARM) to Linux (ARM) using Poco (using v1.4.6p1) such that it can build for both targets. Is this limitation such that it only work on Intel? What about Windows, is that Intel only too? Or is this a limitation of GCC? Do the __sync_fetch_xxx functions not work on ARM? Is there a way to do atomic increment/decrements on ARM?

I guess I'll have to do some testing...

Thanks,
Dan

guenter
Posts: 1194
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: AtomicCounter portability

Postby guenter » 02 Aug 2013, 15:36

If no atomic primitives are available, AtomicCounter falls back to an ordinary int protected by a mutex. So it's still safe and atomic, but slower.

deisenhut
Posts: 11
Joined: 30 Jul 2013, 00:11

Re: AtomicCounter portability

Postby deisenhut » 02 Aug 2013, 15:53

Thanks. Good to know. Will use for now but its something to dig into later if there are performance issues.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest

cron