473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

strange ???

I have a piece of code which is in a multithread program:

....
bool b,b1;
b1 = MyData.success;
//MyData is protected using Mutex, b1=true here by using Visual Studio
watch window
b = (b1 == true);//return false ??????
b = (true && b1);//return true
....

Mar 14 '06 #1
3 1565
kathy wrote:
I have a piece of code which is in a multithread program:

...
bool b,b1;
b1 = MyData.success;
//MyData is protected using Mutex, b1=true here by using Visual Studio
watch window
b = (b1 == true);//return false ??????
b = (true && b1);//return true
...


We can't help you unless you post complete compilable code.
Unfortunately, if you do that, it'll be off topic.

Best bet is to ask in a newsgroup where multithreading on Windows is
topical, perhaps somewhere in the public.microsoft.* hierarchy.

Ben Pope
--
I'm not just a number. To many, I'm known as a string...
Mar 14 '06 #2
kathy wrote:
I have a piece of code which is in a multithread program:

...
bool b,b1;
b1 = MyData.success;
Are you sure it's not

b = MyData.success;

here?
//MyData is protected using Mutex, b1=true here by using Visual Studio
watch window
What's "Mutex"? (A hint: it's not topical here)
b = (b1 == true);//return false ??????
b = (true && b1);//return true
...


This is covered by FAQ 5.8, I think.

V
--
Please remove capital As from my address when replying by mail
Mar 14 '06 #3
"kathy" <yq*****@yahoo.com> wrote in message
news:11**********************@p10g2000cwp.googlegr oups.com...
bool b,b1;
b1 = MyData.success;
//MyData is protected using Mutex, b1=true here by using Visual Studio
watch window
b = (b1 == true);//return false ??????
b = (true && b1);//return true


Without seeing all the code, it's impossible to know for sure...but could it
be that MyData.success was never initialized? It is possible for
uninitialized bool objects to take on values that are neither true nor false
(because undefined behavior really means undefined, when anything can
happen).
Mar 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Arthur | last post by:
I've come across some strange xml, that I need to deal with, it looks like this:- <root> <foo attr="1">Some random strange text. <bar attr="2">blar</bar> <bar attr="3">blar blar</bar> <bar...
2
by: Paul Drummond | last post by:
Hi all, I am developing software for Linux Redhat9 and I have noticed some very strange behaviour when throwing exceptions within a shared library. All our exceptions are derived from...
2
by: Olaf | last post by:
I have a frameset page witch contains the myFuc() function. The function is accessed from a page in one of the frames in the frameset. An example is shown below. <input...
7
by: M O J O | last post by:
Hi, I'm developing a asp.net application and ran into a strange css problem. I want all my links to have a dashed underline and when they are hovered, it must change to a solid line. Sounds...
25
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's...
0
by: unknown | last post by:
Hi, I am developing an online book store with shopping cart. My shopping cart is represented as a Xml server control and I am using an XSLT to render it at the client side. I am using an...
0
by: Kris Vanherck | last post by:
yesterday i started getting this strange error when i try to run my asp.net project: Compiler Error Message: CS0006: Metadata file 'c:\winnt\microsoft.net\framework\v1.1.4322\temporary asp.net...
11
by: Martin Joergensen | last post by:
Hi, I've encountered a really, *really*, REALLY strange error :-) I have a for-loop and after 8 runs I get strange results...... I mean: A really strange result.... I'm calculating...
20
by: SpreadTooThin | last post by:
I have a list and I need to do a custom sort on it... for example: a = #Although not necessarily in order def cmp(i,j): #to be defined in this thread. a.sort(cmp) print a
14
by: blumen | last post by:
Hi all, I'm a newbie in VB.Net Programming.. Hope that some of you can help me to solve this.. I'm working out to read,parse and save textfile into SQL Server. The textfile contains thousands...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.