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 #14167 is a reply to message #14166] Sat, 16 February 2008 17:36 Go to previous messageGo to previous message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
luzr wrote on Sat, 16 February 2008 17:03

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


A misunderstanding? If so, sorry for expressing the issue insufficiently!

I'm talking about the all the "Atomic..." functions in Mt.h, i. e.

AtomicDec,
AtomicInc,
AtomicRead,
AtomicWrite,
AtomicXAdd.

They all have an "Atomic&" as parameter but treat it with an "int" and/or return an "int".

If - and this is the case when using the MSC - "Atomic" is a "long" in disguise, namely typedef'd, implicit casts are inevitable.

I would prefer explicit casts or at least casts which are obvious to me. That is why I suggest to replace the "int" arguments and/or return types with "Atomics".

Werner

P. S.:
"AtomicDec", "AtomicInc", and "AtomicXAdd" are "global" functions. If you discourage their usage, you should document that.

W.
 
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: Sun May 10 00:55:30 GMT+2 2026

Total time taken to generate the page: 0.00420 seconds