Mutex vs Conditional Variable?
477950
That "rule" makes sense to me.  You use a mutex when\nyou want access to a piece of shared data (ie. to update\na counter or insert something into a list).  Note that\nin many implementations, a mutex lock doesn't even\nnecessarily mean a trip through the scheduler (ie. short\nlocks can be done with a spinlock).\n\nGenerally speaking, you do *not* use a condition variable\nwhen you're just waiting for access to data.  Instead, you\nuse it when you're waiting for the data to reach some\ncondition state.  [In fact, the condition variable will\nbe used along with a mutex for access protection.]\n\nYou ask if you could create a condition variable with\nmutexes.  In a sense you could, but (1) it doesn't seem\nparticularly convenient (from the signalling perspective)\nand (2) you'd be inventing your own new design pattern\nthat some other engineer will have to figure out in order\nto support it.  Unless you have a good reason to do things\ndifferently, use the tools as others will expect [and\nhopefully they'll do the same for you :-) ]\n\nTo illustrate the idea of short and long waits, consider \nan example of how a condition variable might be used. \n\nLets say you have a consumer thread which doesn't want\nto begin processing objects in a queue until there are\nenough to meet some threshhold.  Other threads might\nacquire and release the associated data access mutex\nmany times to add elements, but only when they've\nhit the threshhold will one of them explicitly signal\nthe consumer thread to check the condition and begin work.\nIn this situation, the mutex is used for short term\naccesses, but a condition variable is used for a \nlonger-term wait (until the condition is satisfied).
217510
<?= is used as a shortcut to echo or print a variable.\n\n<?=$variable_name;?>\n\nis the same as:\n\n<?print $variable_name;?>
6190
alternative 1)\nUse int/short instead. Make sure you mask potential values with "& 0xff" so they don't overflow.\n\nalternative 2)\nUse (signed) byte for storage, but when doing comparisons, assignment to other integer types, cast to int/short and mask with 0xff
392963
It seems that it gets confused when you use too much of braces. I think, if you want to use second type, bRequired==true will work. However, always try to use less no. of braces so that you will be able to save a lot of space on your web server.
1039633
@ = at the rate\n~ = tilde\n# = hash\n^ = caret
1030606
Randome Access Memory
962535
a-faster\nb-no difference
74620
Given the architecture of the JVM, you need only be concerned with instance and class variables when you worry about thread safety. Because all threads share the same heap, and the heap is where all instance variables are stored, multiple threads can attempt to use the same object's instance variables concurrently. Likewise, because all threads share the same method area, and the method area is where all class variables are stored, multiple threads can attempt to use the same class variables concurrently. When you do choose to make a class thread-safe, your goal is to guarantee the integrity -- in a multithreaded environment -- of instance and class variables declared in that class. \n\nYou needn't worry about multithreaded access to local variables, method parameters, and return values, because these variables reside on the Java stack. In the JVM, each thread is awarded its own Java stack. No thread can see or use any local variables, return values, or parameters belonging to another thread.
958875
"register" declares a variable to be stored in a CPU register rather than RAM.\n\nIt is a hangover from the olden days when the memory CPU bus interface was slow by todays standards. It allowed for faster execution by storing a variable directly into a CPU register instead of RAM eliminating the data fetch execute cycle associated with decoding the address of the data and moving the data in and out of a CPU  register.\n\nThis type is more or less defunct in modern C programming. One of the mostly widely used compilers Microsofts Visual C++ no longer implements this, although it still supports the declaration for backward compatibility. \n\nIn fact when it sees a register variable it just converts it into a normal variable store in RAM. In MS Visual C++ you can even use & on a register variable to get its address which you shouldn't be able to do in ANSI C as an internal CPU register has no address! \n\nModern compilers like Visual C++  automatically use CPU registers if the relevant optimisation is turned on in the compiler flags. Therfore there is no longer any requirements for the programmer to implement low level optimisation using register variables. You could use any alternate data type that suits your needs. e.g. (short) int, long
249072
Try a counter approach.\n\ngetDataObject()\n{\n  synchronized (this)\n  {\n    counter++;\n  }\n  if (!open) throw error;\n  try\n  {\n//  do stuff here...\n    return stuff;\n  }\n  finally\n  {\n    synchronized (this)\n    {\n      counter--;  // must decrement in sync block\n      notifyAll();\n    }\n  }\n}\n\nsynchronized close()\n{\n  // counter is guaranteed not to decrement\n  while (counter > 0)\n    wait();  // until here, so we won't miss the notifyAll from above!\n  open = false;\n}\n\nI deserve a beer for this I think...
756381
i think dep(data execution protection) does a pretty neat job, i.e if ur processor (usually 64 bit) has dep and if u use an os(winxp with sp2) that has dep, can prevent data execution from data pages. ps if you use software that has similar features, it can be minimized.\nalso if you have a good antivius, then it should block data execution(having a good worm protection is also advisable)
1180902
I am sure this link will help you\n\nhttp://66.102.9.104/search?q=cache:PxXilZ_c9ZcJ:www.ittc.ku.edu/~dandrews/files/ERSA2004.pdf+spinlock+or+semaphore+work,+the+processor+implement+a+lock&hl=en&gl=uk&ct=clnk&cd=2
299602
Try and use an IDE if you can. Or switch to linux for programming, you wont have to use getch() or pause :)
872256
Threads share a virtual memory mapping, so switching between them does not invalidate the TLB and creating them does not require marking pages copy on write. \n\nDue to the lack of an expensive TLB flush, switching between two threads in the same virtual address space will be quicker then switching between processes (which by definition have separate address spaces and thus require the TLB flush).\n\nThe exact details vary depending on OS and processor type, but the above is more or less correct for X86 style chips running a 1:1 threading model. \n\nRegards, Dan.
289574
Control+break ... It works good.. depends of the programs it can stop fast... it´s like End task in windows
415746
conditional statement and its inverse
357099
void\nmain()\n{\n   if (printf("morgan&#92;n")) {\n   }\n}\n\n\nNo semi's -- no problem.