What is the meaning of [threw in the towel]

After losing his queen, the chess player threw in the towel (give up) and resigned.