Thread flock funktioniert nicht (64 answers)
Opened by x-man at 2006-04-17 19:11

pq
 2006-04-17 20:29
#7338 #7338
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
besser:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
# ungetestet
use Fcntl qw(:flock);

sub lock {
  my ($fh, $mode) = @_;
  flock $fh, $mode;
}
...
lock(\*FH, LOCK_EX); # exclusive
# lock(\*FH, LOCK_SH); # shared


ein flock $fh, 8 (also unlock) solltest du lassen, denn durch das close wird
ja automatisch der lock aufgehoben. das ist vermutlich auch die fehlerursache.

wenn der provider flock() verbietet, würde ich wechseln.\n\n

<!--EDIT|pq|1145291611-->
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: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread flock funktioniert nicht