summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a4104b1)
raw | patch | inline | side by side (parent: a4104b1)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 15 Jan 2008 18:37:21 +0000 (18:37 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 15 Jan 2008 18:37:21 +0000 (18:37 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8375 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-server | patch | blob | history | |
gosa-si/modules/DBsqlite.pm | patch | blob | history | |
gosa-si/tests/client.php | patch | blob | history |
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 5ad1a8f3fce73dd8075752d08410d413faf13725..f0b59ce9c83c195429b2270e6d2940a0f8808862 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
use File::Spec;
use GOSA::GosaSupportDaemon;
use GOSA::DBsqlite;
+use threads;
my $modules_path = "/usr/lib/gosa-si/modules";
use lib "/usr/lib/gosa-si/modules";
# RETURNS: nothing
# DESCRIPTION: function for logging
#===============================================================================
-sub daemon_log {
+sub daemon_log : locked {
# log into log_file
my( $msg, $level ) = @_;
if(not defined $msg) { return }
$free_child{$pid} = $child_hash;
# give the client a chance to read
- sleep(5);
- close ($act_client);
+ #sleep(1);
+ #close ($act_client);
}
}
index 6f727b20007d37b3a3186329b65150d3420af70a..618dd00c7869a624b9ea9a955ed835afbb068e26 100644 (file)
use warnings;
use DBI;
use Data::Dumper;
+use threads;
+use Time::HiRes qw(usleep);
my $col_names = {};
-my $checking=0;
sub new {
my $class = shift;
return($self);
}
-sub lock_exists {
- while($checking) {
- sleep 1;
- }
- $checking=1;
+sub lock_exists : locked {
my $self=shift;
my $funcname=shift;
my $lock = $self->{db_lock};
my $result=(-f $lock);
if($result) {
print STDERR "(".((defined $funcname)?$funcname:"").") Lock (PID ".$$.") $lock gefunden\n";
- sleep 2;
+ usleep 100;
}
- $checking=0;
return $result;
}
-sub create_lock {
+sub create_lock : locked {
my $self=shift;
my $funcname=shift;
print STDERR "(".((defined $funcname)?$funcname:"").") Erzeuge Lock (PID ".$$.") ".($self->{db_lock})."\n";
+
+ my $lock = $self->{db_lock};
+ while( -f $lock ) {
+ print STDERR "(".((defined $funcname)?$funcname:"").") Lock (PID ".$$.") $lock gefunden\n";
+ sleep 1;
+ }
+
open($self->{db_lock_handle},'>',$self->{db_lock});
}
-sub remove_lock {
+sub remove_lock : locked {
my $self=shift;
my $funcname=shift;
print STDERR "(".((defined $funcname)?$funcname:"").") Entferne Lock (PID ".$$.") ".$self->{db_lock}."\n";
index 1d93746de0585e85157b269dbeb438b4ce585c29..e3678623ef7c333b9e5398a843d25b9110aa897d 100755 (executable)
--- a/gosa-si/tests/client.php
+++ b/gosa-si/tests/client.php
# clear
#$data = "<xml> <header>gosa_clear_jobdb</header> </xml>";
- $sock->write($data);
-
- $answer = $sock->read();
- echo "$answer\n";
+ $sock->write($data);
+ $answer = "nothing";
+ $answer = $sock->read();
+ echo ">>>$answer<<<\n";
$sock->close();
}else{
echo "... FAILED!\n";