Click here to Skip to main content
15,905,914 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: is the dataview being updated as I modify it? Pin
JoeRip21-Dec-06 10:44
JoeRip21-Dec-06 10:44 
QuestionHow do I handle events for dropdown menu items created on the fly? Pin
JoeRip20-Dec-06 20:43
JoeRip20-Dec-06 20:43 
AnswerRe: How do I handle events for dropdown menu items created on the fly? Pin
Tarakeshwar Reddy20-Dec-06 21:11
professionalTarakeshwar Reddy20-Dec-06 21:11 
GeneralRe: How do I handle events for dropdown menu items created on the fly? Pin
JoeRip20-Dec-06 21:21
JoeRip20-Dec-06 21:21 
GeneralRe: How do I handle events for dropdown menu items created on the fly? Pin
Tarakeshwar Reddy20-Dec-06 21:30
professionalTarakeshwar Reddy20-Dec-06 21:30 
GeneralRe: How do I handle events for dropdown menu items created on the fly? Pin
JoeRip20-Dec-06 21:49
JoeRip20-Dec-06 21:49 
GeneralRe: How do I handle events for dropdown menu items created on the fly? Pin
Tarakeshwar Reddy20-Dec-06 22:00
professionalTarakeshwar Reddy20-Dec-06 22:00 
QuestionSharing data across threads Pin
Hendrik Debedts20-Dec-06 4:09
Hendrik Debedts20-Dec-06 4:09 
Consider the following:

namespace Lesson2
{
class Program
{
static void Main(string[] args)
{
System.Threading.ThreadStart oThreadStart;
oThreadStart = new System.Threading.ThreadStart(UpdateCount);

System.Threading.Thread[] oThreads;
oThreads = new System.Threading.Thread[10];

for (int i = 0; i < oThreads.Length; i++)
{
oThreads[i] = new System.Threading.Thread(oThreadStart);
oThreads[i].Start();
}

// Wait for them to complete
for (int i = 0; i < oThreads.Length; i++)
{
/*
* The different threads in 'oThreads' use the same
* variable 'Counter.Count'.
* => The variable 'Counter.Count' is shared by these threads.
*
* Without 'Join' the 'WriteLine' does his work before the
* last thread is done.
* => Total is less then 100.000.
*/

oThreads[i].Join();
}

/*
* Show to the console the total value of 'Counter.Count'
*(after the 10 threads)
* Should be 10 * 10.000 = 100.000
*/

Console.WriteLine("Total: {0}", Counter.Count);
Console.ReadLine();
}

static void UpdateCount()
{
for (int i = 1; i <= 10000; ++i)
{
Counter.Count = Counter.Count + 1;
}
}
}

public class Counter
{
public static int Count;
}
}

The expected 'Total' that is written to the console is '100.000' (10 threads that increment 'Counter.Count' with '10.000').

The book i'm currently reading
(http://www.amazon.com/MCTS-Self-Paced-Training-Exam-70-536/dp/0735622779)
says that if you run this code on a hyperthreading- or a multiprocessorsystem
the 'Total' that is written to the console will sometimes be less than '100.000'. I don't understand the explanation.
AnswerRe: Sharing data across threads Pin
Keith Malwitz20-Dec-06 6:03
Keith Malwitz20-Dec-06 6:03 
GeneralRe: Sharing data across threads Pin
Hendrik Debedts20-Dec-06 23:35
Hendrik Debedts20-Dec-06 23:35 
QuestionShockwave Flash Component in visual studio 2005 Pin
morteza5719-Dec-06 23:37
morteza5719-Dec-06 23:37 
QuestionGetting reference of calling Assembly. Pin
Syed Muhammad Kamran19-Dec-06 18:55
Syed Muhammad Kamran19-Dec-06 18:55 
GeneralRe: Getting reference of calling Assembly. Pin
Guffa19-Dec-06 19:17
Guffa19-Dec-06 19:17 
QuestionExecutionContext Pin
Hendrik Debedts19-Dec-06 12:19
Hendrik Debedts19-Dec-06 12:19 
QuestionDetermining Memory Footprint of a filled Dataset Pin
Keith Malwitz19-Dec-06 6:25
Keith Malwitz19-Dec-06 6:25 
QuestionARCHITECTURAL DIFFERENCE between .net 1.0 and 2.0? Pin
karam chandrabose19-Dec-06 0:40
karam chandrabose19-Dec-06 0:40 
AnswerRe: ARCHITECTURAL DIFFERENCE between .net 1.0 and 2.0? Pin
Paul Conrad19-Dec-06 5:59
professionalPaul Conrad19-Dec-06 5:59 
AnswerRe: ARCHITECTURAL DIFFERENCE between .net 1.0 and 2.0? Pin
Pete O'Hanlon19-Dec-06 11:32
mvePete O'Hanlon19-Dec-06 11:32 
QuestionGUI Interface of a service Pin
christopheL19-Dec-06 0:23
christopheL19-Dec-06 0:23 
AnswerRe: GUI Interface of a service Pin
PIEBALDconsult19-Dec-06 3:22
mvePIEBALDconsult19-Dec-06 3:22 
GeneralRe: GUI Interface of a service Pin
christopheL19-Dec-06 3:58
christopheL19-Dec-06 3:58 
QuestionHow to Edit a Data Grid, using Text Box or Combobox Pin
Kushwaha2k18-Dec-06 23:53
Kushwaha2k18-Dec-06 23:53 
AnswerRe: How to Edit a Data Grid, using Text Box or Combobox Pin
kinnuP20-Dec-06 0:28
kinnuP20-Dec-06 0:28 
Questionseparate .config file Pin
knez18-Dec-06 23:05
knez18-Dec-06 23:05 
Question.Net:Globalization and SQL:Collate Pin
enduro1x18-Dec-06 18:42
enduro1x18-Dec-06 18:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.