Thread flock funktioniert nicht
(64 answers)
Opened by x-man at 2006-04-17 19:11
[quote=nepos,18.04.2006, 14:23]Wenn ich das aus der Doku zu flock richtig lese, muesste man das Ergebnis von flock in ner Schleife auswerten. Sprich, ich warte solange, bis mir das flock ein TRUE zurueckgibt und damit anzeigt, dass er erfolgreich das Lock erhalten hat.
Solange von flock ein FALSE kommt, muss die Anwendung weiter warten. Oder sehe ich das nun falsch?[/quote] nein, flock() ist schon so schlau, dass es selbst wartet, bis es den zuschlag kriegt. "If LOCK_NB is bitwise-or'ed with LOCK_SH or LOCK_EX then "flock" will return immediately rather than blocking waiting for the lock (check the return status to see if you got it)." Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: ![]() ![]() |