Click here to Skip to main content
16,005,389 members
Home / Discussions / C#
   

C#

 
Generalcontrol the connection Pin
Ahmed Mazrou39-Aug-03 17:16
Ahmed Mazrou39-Aug-03 17:16 
GeneralRe: control the connection Pin
Ista10-Aug-03 10:18
Ista10-Aug-03 10:18 
GeneralIF STATMENT Pin
eggie59-Aug-03 17:01
eggie59-Aug-03 17:01 
GeneralRe: IF STATMENT Pin
eggie59-Aug-03 17:41
eggie59-Aug-03 17:41 
GeneralRe: IF STATMENT Pin
Csharp™10-Aug-03 0:25
Csharp™10-Aug-03 0:25 
GeneralRe: IF STATMENT Pin
eggie510-Aug-03 18:23
eggie510-Aug-03 18:23 
GeneralPlease help decipher this MSDN threading sample! Pin
devvvy9-Aug-03 16:26
devvvy9-Aug-03 16:26 
GeneralRe: Please help decipher this MSDN threading sample! Pin
Meysam Mahfouzi10-Aug-03 17:31
Meysam Mahfouzi10-Aug-03 17:31 
I think by only changing one variable name you will get out the confusing situation you are in!;)

Just change 'readerFlag' name to 'dataAvailable'
You see? every thing's now clear, huh?

norm wrote:
public void WriteToCell(int n)
{
lock(this) // Enter synchronization block: The "lock()" block.
{
if (readerFlag)
{ // Why do you need this flag if you have already "lock" the resource???
}

} // Q1-b: Lock release here - my understanding correct?? This means you can do whatever you want in the "lock" block.? (Exiting THE "lock()"-block)

}
}


Suppose you want to read the cell, so you lock it, and you may see nothing is available in cell, so what should you do? Ahhhhaaaa, you should release the lock and wait until the writer puts some thing in cell and signals you to wake up, again acquire the lock and read the cell.

the same happens for writer, if cell is full, it will wait untill reader reads the cell.

I hope this helps Smile | :)

Rose | [Rose] Rose | [Rose] Rose | [Rose] Rose | [Rose] Rose | [Rose] Rose | [Rose] Rose | [Rose] Rose | [Rose]



Don't forget, that's
Persian Gulf
not Arabian gulf!
GeneralRe: Please help decipher this MSDN threading sample! Pin
devvvy11-Aug-03 2:56
devvvy11-Aug-03 2:56 
GeneralRe: Please help decipher this MSDN threading sample! Pin
devvvy13-Aug-03 6:57
devvvy13-Aug-03 6:57 
GeneralWSDL question Pin
Mazdak9-Aug-03 9:52
Mazdak9-Aug-03 9:52 
GeneralRe: WSDL question Pin
James T. Johnson9-Aug-03 11:27
James T. Johnson9-Aug-03 11:27 
GeneralRe: WSDL question Pin
Ista9-Aug-03 12:13
Ista9-Aug-03 12:13 
GeneralRe: WSDL question Pin
Mazdak10-Aug-03 1:54
Mazdak10-Aug-03 1:54 
GeneralRe: WSDL question Pin
Ista10-Aug-03 9:53
Ista10-Aug-03 9:53 
Generalcode for email address validation on logon web application Pin
gilstelzer9-Aug-03 6:09
gilstelzer9-Aug-03 6:09 
GeneralRe: code for email address validation on logon web application Pin
leppie9-Aug-03 7:36
leppie9-Aug-03 7:36 
GeneralNUnit testing in Visual Studio Pin
Will Ballard9-Aug-03 4:27
Will Ballard9-Aug-03 4:27 
GeneralFinding Char Index in current line Pin
.gonad9-Aug-03 2:35
.gonad9-Aug-03 2:35 
GeneralRe: Finding Char Index in current line Pin
Ista9-Aug-03 5:12
Ista9-Aug-03 5:12 
GeneralRe: simple messagebox Pin
J. Dunlap8-Aug-03 22:42
J. Dunlap8-Aug-03 22:42 
GeneralRe: simple messagebox Pin
Ista9-Aug-03 9:53
Ista9-Aug-03 9:53 
GeneralBarcode reader and Receipt printer Pin
ChiYung8-Aug-03 19:53
ChiYung8-Aug-03 19:53 
GeneralRe: Barcode reader and Receipt printer Pin
AdrianT9-Aug-03 1:12
AdrianT9-Aug-03 1:12 
GeneralRe: Barcode reader and Receipt printer Pin
ChiYung9-Aug-03 8:07
ChiYung9-Aug-03 8:07 

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.