Do you mean technically or legally? Legally you need to be dead for the hospital to recover organs. But technically, the amount of time you need to be without oxygen to go into a persistive vegetative state is much less than the viability window of your organs. The time between death and viable organ recovery varies on the organ itself and how soon the body was chilled. Heart and lungs must be transplanted within 4-6 hours but other organs and tissue can last much longer. It also depends on how you die: starving to death several days after having your feeding tube removed may make your organs unviable but dying shortly after being removed from a ventilator could still produce viable organs.