General Safety Assumputions
Wear a Personal Flotation Device (PFD) aka Life Jacket.
Don't give up. Like much of whitewater never give up. Keep fighting. Keep trying new things. If you have air great, breathe it. If you are in a stable spot great, use it to figure out your next move but never give up.
These are whirlpools which form along the vertical axis. The form as water passes around the sides of a rock or other obstruction. Most paddlers identify eddies as islands of safety since it is one method to make river running easier and safer. In powerful enough water these "whirl pools" or more typically "eddy lines" can pull down swimmers and even boats, but they weaken as they move down stream. Waiting out the down time and moving for shore or into the main current is typically all that is needed to handle these. Starting small and experimenting with these features will give you a good idea when to play with these features and when to avoid them.
These are whirlpools which form on the horizontal axis as water moves over a rock or other obstruction. The current in a hole is surface water moving upstream and deep water moving downstream. At the upstream side of the hole water is plunging deep and at the downstream end water is percolating upwards. The real trick is how big are you or your boat compared to the hole. If you are very big you will stay on the surface and will likely not be stopped in the first place. If you are very small you will likely go underwater with but resurface well down stream. If you are in that magic size in the middle you will get stuck.
In Boat Hole Exits
In a boat there are a few strategies for exiting the feature. The first most are likely to try is reaching downstream and grabbing downstream moving water. This rarely works and most that try put their shoulders at risk. This will only work on the weakest of features. The next step is to work towards the corners of the hole. Most holes are not perpendicular to the current and "kick" either left or right. Don't fight the kick. Sometimes this means backing out of the hole if your boat is facing the wrong way. If one side doesn't seem to work try the other. If the hole pushes you back to the middle (frown shaped looking downstream) then you will need to try something different. Purposely flipping the boat might present enough surface area from your body to push you downstream. It's amazing the number of features that will hold an upright boat all day but immediately flush an upside down boat. If that doesn't work try throwing ends. You don't need to a be a freestyle expert to try this. Just plug your bow or stern in the upstream current and the boat will go deep and vertical. The goal is to go as deep as you can to catch more of the downstream water and sometimes even jump over some recirculating water. If none of this works and help isn't available an out of boat rescue may be the next move.
Out of Boat Hole Exits
Much like flipping seems to turn many would be keepers into a flushing hole, it's amazing how many features will flush a swimmer immediately after a long a violent ride in the boat. Of coarse swimming offers it's own hazards and should be avoided whenever possible. Most river fatalities occur when swimming not inside boats. If you do not flush immediately you are dealing with a very dangerous feature and not a lot of time. There is basically 3 things you can do, swim (on your belly freestyle strokes) at the edges of the holes and into upstream current, cannonball and starfish. My immediate move would be to swim aggressively into the upstream current When I hit it starfish to maximize surface area and cannonball when the jet of current pushes less to reduce surface area and go deep. If that doesn't work try again and if that doesn't work try a different combination of the above. Basically swim, cannonball, starfish offer 3 different moves that will work most of the time. That said not always. Some features you can't get out of without help.
There are a number of rescue techniques for getting someone else out of a bad feature. They simplest and most common is a throw rope.
Boat based rescues can also be good but can easily turn one victim into two. Use with caution.
The really good news about all this is avoidance is fairly easy. Most bad features occur at man made dams. Whenever you see one, your first instinct should be to look for a place to get out and look at the feature to see what you are dealing with. If you can't read water, portage around even if it looks like a small easy drop.
Naturally occurring features like this typically only happen on advanced rivers where water reading skills and setting safety are ubiquitous. The rare feature the occurs on an easier river will be well known to locals and as always they should be tapped for run information whenever possible.