Hi Massimo.

Yes it is relevant as it is a command name, and not a variable.

I think I understands what's going on with the Thread.

The thread has its own interpreter created de facto. So my command is known
only from that interpreter, and not from the Rivet's main interpreter.



On Tue, Jun 12, 2018 at 10:22 AM, Massimo Manghi <massimo.man...@unipr.it>
wrote:

> In case I try to test this code I have a question: is the call to [ynet
> new] relevant somehow? I guess it can be replaced by a function that
> returns a random string
>
>  -- Massimo
>
>
> On 06/12/2018 01:40 PM, Brice Hamon wrote:
>
>> Hi Massimo,
>>
>> Ok we are getting somewhere.
>>
>> I started a TCL thread, which loads my lib, create a session and starts
>> it, followed by a vwait forever.
>>
>> This worked. I see the readycmd procedure been called when all the c++
>> code is happy.
>>
>> It is not that easy to explain so here is what I do in the RivetChildInit:
>>
>>
>> set tid [thread::create]
>>
>> thread::send -async $tid {
>>
>> proc ::readycmd {} {
>>      puts [info commands]
>>      puts [namespace children ::]
>>      puts [info procs]
>> }
>>
>> proc ::errorcmd {txt} {
>>      log ERROR "SB: $err"
>> }
>>
>>          # Opening the link
>>          if {[catch {load -global libThreadTclApi.so threadtclapi} err]} {
>>              puts "Error loading the libThreadTclApi.so library: $err"
>>          }
>>
>>          # Creating a session
>>          set ::sess_ [ynet new]
>>          $::sess_ configure -daemon y1 -port 2002
>>          $::sess_ configure -readycmd ::readycmd
>>          $::sess_ configure -errorcmd ::errorcmd
>>          $::sess_ open
>>          vwait forever
>> }
>>
>> This code works but still 2 things is happening:
>>
>> 1) If the proc readycmd  is defined outside the thread's script, the
>> library is not be able to call it and generates an error.
>>
>> 2) on the rvt page, I can't see the ::sess_ variable nor that I see my
>> library's new command.
>>
>> So the there is still things not working as I was hoping they will.
>>
>> Thank you,
>> Brice.
>>
>>
>>
> Firma il tuo 5 x mille all’Università di Parma e aiuta così i nostri
> studenti che vogliono realizzare un’esperienza di studio all’estero –
> Indica 00308780345 nella tua denuncia dei redditi.
>

Reply via email to