Click here to Skip to main content
15,916,378 members
Home / Discussions / C#
   

C#

 
GeneralRe: Loading 500000 rows in to a datatable Pin
chandler8330-Nov-06 19:35
chandler8330-Nov-06 19:35 
GeneralRe: Loading 500000 rows in to a datatable Pin
Not Active30-Nov-06 20:03
mentorNot Active30-Nov-06 20:03 
GeneralRe: Loading 500000 rows in to a datatable Pin
Christian Graus30-Nov-06 22:27
protectorChristian Graus30-Nov-06 22:27 
AnswerRe: Loading 500000 rows in to a datatable Pin
Bassam Saoud30-Nov-06 19:35
Bassam Saoud30-Nov-06 19:35 
AnswerRe: Loading 500000 rows in to a datatable Pin
V.30-Nov-06 20:46
professionalV.30-Nov-06 20:46 
QuestionRunning asmx without iis Pin
pkt3030-Nov-06 17:42
pkt3030-Nov-06 17:42 
AnswerRe: Running asmx without iis Pin
Christian Graus30-Nov-06 18:02
protectorChristian Graus30-Nov-06 18:02 
QuestionAnother Thread Question (Dumb) Pin
Tristan Rhodes30-Nov-06 13:12
Tristan Rhodes30-Nov-06 13:12 
I've been programming under the assumption that taking a lock out on an object will get an exclusive lock out, so no other thread can enter any region that uses the same object as a lock.

i.e.
<br />
void Read()<br />
{<br />
lock(obj)<br />
{<br />
// Do Stuff Here<br />
}<br />
}<br />
<br />
void Write(data)<br />
{<br />
lock(obj)<br />
{<br />
// Do Stuff Here<br />
}<br />
}<br />


Now i was thinking that a synronous call to Read and Write would lock 'obj' and prevent two threads from
doing different things at the same time.

However, while debugging an app (That i had tested with numerous multi threaded scenarios and had no problems), i found that i could have a breakpoint in Read and a breakpoint in write, and they would hit alternatively, while there was still logic to be executed in both blocks. This has made me wonder whether i'm totaly wrong about the whole locking mechanism and whether a lock is only obtained for a particular region of code, rather than the object itself.

Alternativly, could this be an issue with Debugging and stepping through multi threaded apps?

Can anyone shed any light on the subject please?

Cheers

Tristan RHodes
AnswerRe: Another Thread Question (Dumb) Pin
S. Senthil Kumar30-Nov-06 23:18
S. Senthil Kumar30-Nov-06 23:18 
QuestionQuestion Pin
tamerana200430-Nov-06 11:06
tamerana200430-Nov-06 11:06 
AnswerRe: Question Pin
Christian Graus30-Nov-06 11:18
protectorChristian Graus30-Nov-06 11:18 
QuestionAsking about the best way to place huge images in a ListView ? Pin
Marcos Hernandez30-Nov-06 10:11
Marcos Hernandez30-Nov-06 10:11 
AnswerRe: Asking about the best way to place huge images in a ListView ? Pin
Christian Graus30-Nov-06 11:18
protectorChristian Graus30-Nov-06 11:18 
GeneralRe: Asking about the best way to place huge images in a ListView ? Pin
Marcos Hernandez30-Nov-06 19:47
Marcos Hernandez30-Nov-06 19:47 
QuestionFunction that never returns Pin
Vega0230-Nov-06 8:46
Vega0230-Nov-06 8:46 
AnswerRe: Function that never returns Pin
Ed.Poore30-Nov-06 8:48
Ed.Poore30-Nov-06 8:48 
GeneralRe: Function that never returns Pin
Vega0230-Nov-06 9:01
Vega0230-Nov-06 9:01 
GeneralRe: Function that never returns Pin
Dave Kreskowiak30-Nov-06 9:11
mveDave Kreskowiak30-Nov-06 9:11 
GeneralRe: Function that never returns Pin
led mike30-Nov-06 11:58
led mike30-Nov-06 11:58 
GeneralRe: Function that never returns Pin
Vega0230-Nov-06 16:50
Vega0230-Nov-06 16:50 
GeneralRe: Function that never returns Pin
Ed.Poore30-Nov-06 12:06
Ed.Poore30-Nov-06 12:06 
AnswerRe: Function that never returns Pin
Pete O'Hanlon30-Nov-06 9:00
mvePete O'Hanlon30-Nov-06 9:00 
AnswerRe: Function that never returns Pin
Guffa30-Nov-06 9:11
Guffa30-Nov-06 9:11 
GeneralRe: Function that never returns Pin
Vega0230-Nov-06 9:19
Vega0230-Nov-06 9:19 
QuestionListView Select Removing SelectedItem Pin
smarttom9930-Nov-06 7:15
smarttom9930-Nov-06 7:15 

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.