Alice and Bob publicly choose the messages $M_A$ and $M_B$ and independently sign them (Alice privately signs $M_A$, Bob signs $M_B$).
Now Alice and Bob are looking for a protocol that allows them to:
Make sure the other party's signature is valid (in a malicious adversary model)
Only reveal their own signature if they're guaranteed by the protocol to learn the other party's signature as well (atomic reveal)
Not rely on a trusted dealer
Is there such a protocol possible to construct? Can it be extended to N parties instead of 2? Can it work with an ECDSA signature scheme?
Edit: After researching the topic more and thanks to the answers below, I found out this is commonly known as a (strong) fair-exchange protocol and it's impossible in the two-party setup without a trusted third party. However, optimistic fair exchange protocols are possible and they only rely on a trusted party if one of the participants attempts to cheat.