If you suspect you're in danger of being fired, you don't just need to sit back and worry and wait for it to happen. If you're proactive about addressing it, you have a pretty good chance of making the situation better for yourself. I'm not saying you can magically keep your job, but you might be able to turn a pretty unpleasant situation into something much more manageable.

Start by asking your manager to talk honestly with you. Tell him or her that you know you're not excelling in the position-or if that's not strictly accurate, that you know he or she isn't happy with your performance-and ask what you could do to improve. Then-and this is key-ask for his or her honest assessment of whether you're likely to be able to make the improvements needed to succeed in the job in the long run.

Maybe you'll get helpful information that you can use to turn things around-but if instead you get a bleak assessment of your future in that job, this is where there's a hidden opportunity most people don't use.

Say something like, "I appreciate you being candid with me. I wonder if we can make arrangements now to plan for a transition that will be as smooth as possible for both of us. I'm going to go on trying to do a good job, but knowing that you don't believe a positive outcome is likely, it sounds like I should also start looking for a new position. If that's the case, would you be willing to work with me while I conduct a job search? That obviously will help me, and it will give you time to search for a replacement and have a smooth transition, and I can be as involved as you'd like in bringing the new person up to speed."

Many managers are likely to hear this with relief. No one wants to fire an employee if it can be avoided, both for legal reasons and because, for most people, it's a tough thing to do and can be emotionally draining. By making it easy for your employer to end the relationship and offering terms that help you both, you're maximizing the chance that they'll work with you in the way you've proposed. You'll get some grace time to find a new job, you won't have to explain a termination in future job searches, and you'll gain more control over the situation than you'd otherwise have.

One important caveat: There's no guarantee your employer will take you up on this. You know your company culture and your manager best, and you should take those into account before proceeding this way. In some situations, some (not all) companies might respond with, "It sounds like you're resigning, and we'll accept that." So proceed with caution, and let your knowledge of your employer be your guide.