From: mquinson Date: Thu, 4 Mar 2010 15:57:35 +0000 (+0000) Subject: Even more debugging info X-Git-Tag: SVN~546 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/18e8a1c4541f992e82b48f3d17202ba6fd5386a0?hp=3a9b798b57c4829af0d66681aa7ca29e401aa9f8 Even more debugging info git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7193 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/bindings/ruby/rb_msg_task.c b/src/bindings/ruby/rb_msg_task.c index fcca60198a..38068703e1 100644 --- a/src/bindings/ruby/rb_msg_task.c +++ b/src/bindings/ruby/rb_msg_task.c @@ -67,7 +67,7 @@ void rb_task_send(VALUE class,VALUE task,VALUE mailbox) { VALUE rb_task_receive(VALUE class, VALUE mailbox) { // Task m_task_t task = NULL; - INFO1("Receiving a task on mailbox '%s'",RSTRING(mailbox)->ptr); + INFO2("Receiving a task on mailbox '%s', store it into %p",RSTRING(mailbox)->ptr,&task); MSG_task_receive(&task,RSTRING(mailbox)->ptr); INFO2("XXXXXXXXReceived a task %p %s",task,task->name); return Data_Wrap_Struct(class, 0, rb_task_free, task); diff --git a/src/bindings/ruby/simgrid.rb b/src/bindings/ruby/simgrid.rb index c82542a883..9bd954bc86 100644 --- a/src/bindings/ruby/simgrid.rb +++ b/src/bindings/ruby/simgrid.rb @@ -3,8 +3,6 @@ require 'simgrid_ruby' require 'thread' -$DEBUG = false # This is a Global Variable Useful for MSG::debugging - ########################################################################### # Class Semaphore ########################################################################### @@ -50,11 +48,13 @@ class Semaphore end def acquire - MSG::debug(Thread.current.to_s+" acquires "+self.to_s) Thread.critical = true if (@counter -= 1) < 0 + MSG::debug(Thread.current.to_s+" acquires "+self.to_s+". That's blocking.") @waiting_list.push(Thread.current) Thread.stop + else + MSG::debug(Thread.current.to_s+" acquires "+self.to_s+". It was free.") end self ensure @@ -62,15 +62,14 @@ class Semaphore end def release - MSG::debug(Thread.current.to_s+" releases "+self.to_s) Thread.critical = true begin if (@counter += 1) <= 0 t = @waiting_list.shift t.wakeup if t - MSG::debug("Wakeup "+t.to_s) + MSG::debug(Thread.current.to_s+" releases "+self.to_s+". Wakeup "+t.to_s) else - MSG::debug("Nobody to wakeup") + MSG::debug(Thread.current.to_s+" releases "+self.to_s+". Nobody to wakeup") end rescue ThreadError retry @@ -93,7 +92,7 @@ class MSG::Process < Thread def initialize(*args) super(){ - raise "Bad Number Of arguments to create a Ruby Process (name,args,prop) " if args.size < 3 + raise "Bad number of arguments to create a Ruby process. Expected (name,args,prop) " if args.size < 3 # @cv = ConditionVariable.new # @mutex = Mutex.new @@ -109,17 +108,14 @@ class MSG::Process < Thread } end - # main def main(args) # To be overriden by childs raise("You must define a main() function in your process, containing the code of this process") end - # Start : To keep the process alive and waiting via semaphore def start() @schedBegin.acquire() - # execute the main code of the process - MSG::debug("Begin execution") + MSG::debug("Let's execute the main() of the Ruby process") main(@pargs) # processExit(self) # Exit the Native Process @schedEnd.release() @@ -187,7 +183,8 @@ class MSG::Task < MSG::RbTask super(self,mailbox) end -# FIXME : this methode should be associated to the class !! it reurn a task +# FIXME : this method should be associated to the class !! it return a task +# FIXME: simply killing this adapter method should do the trick def receive(mailbox) super(self,mailbox) end @@ -211,7 +208,6 @@ class MSG::Task < MSG::RbTask def listenFromHost(t_alias,host) super(t_alias,host) end - end ############################################ @@ -246,7 +242,6 @@ class MSG::Host < MSG::RbHost def number super() end - end #########################