Knee locking refers to when the leg gets stuck in one position, making it impossible to bend or straighten it. It may only last a few seconds, it may last longer. It all depends on what is causing it. Most cases fall into one of two categories.
There is true locking caused by a mechanical block where something gets stuck inside the joint, preventing movement. This type most commonly occurs as you move the knee into full extension, i.e. towards being fully straight.
Secondly, there is pseudo locking, caused by severe pain which temporarily limits movement in any direction.