U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ MT-multithreading and servers » Intentionally inconstistent use of "Atomic" in Mt.h?
Re: Intentionally inconstistent use of "Atomic" in Mt.h? [message #14166 is a reply to message #14165] Sat, 16 February 2008 17:03 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
Werner wrote on Sat, 16 February 2008 07:19

All the Atomic... functions in Mt.h (be it WIN32 or POSIX) return int - but shouldn't it be Atomic?

The type of Atomic depends:

MT & POSIX: _Atomic_word -> int
MT & WIN32: LONG -> long
ST & POSIX: int
ST & WIN32: int

Indeed the called WIN32 functions Interlocked... return long. So, to avoid implicit casts it might be preferable to adapt the return type of the Atomic... functions. If I then assign an Atomic to an int, I am seeing what I am doing.

Werner



Well, but you should not directly assign Atomic to int, you should rather use AtomicRead...

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Distant file info
Next Topic: Checking socket connection after send.
Goto Forum:
  


Current Time: Sat May 09 17:21:40 GMT+2 2026

Total time taken to generate the page: 0.00533 seconds