You can use a global static variable isLocked as boolean intialized as false.
Class B
{
B()
{
while (!isLocked) {
isLocked = true
MethodB()
isLocked = false
}
}
}
You can use similar procedure where you are calling Method A from Class A. This will prevent methodA and MethodB called simultaneously.