No. You really do not want to use a while loop. See (OH 1.x and OH 2.x Rules DSL only] Why have my Rules stopped running? Why Thread::sleep is a bad idea. This would be an example of The XY Problem.
Luckily you provided enough detail to provide the proper solution which rossko57 outlines. The rule would look something like:
Rules DSL:
rule "Freigabe"
when
Item Schaltaktor_2_Current changed
then
if(Schaltaktor_2_Switch.state != ON) return;
var newState = OFF
if(Schaltaktor_2_Current.state > 100) newState = ON
if(vFreigabe.state != newState) vFreigabe.sendCommand(newState)
end
JSR223 Python using the Helper Libraries:
from core.rules import rule
from core.triggers import when
from core.utils import sendCommandCheckFirst
@rule("Freigabe", description="Sets vFreigabe to ON while Schaltaktor_2_Current > 100")
@when("Item Schaltaktor_2_Current changed")
def freigabe(event):
if items["Schaltaktor_2_Switch"] != ON: return
sendCommandCheckFirst("vFreigabe", ON if items["Schaltaktor_2_Current"] > DecimalType(100) else OFF)