IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Tcl/Tk Discussion :

Boucle infinie si Tcl_CreateInterp est appelé depuis des threads différentes


Sujet :

Tcl/Tk

  1. #1
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Novembre 2009
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2009
    Messages : 1
    Points : 1
    Points
    1
    Par défaut Boucle infinie si Tcl_CreateInterp est appelé depuis des threads différentes
    Salut,

    Voici un bout de code très simple:

    Code c++ : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    #include "tcl.h"
    #include <boost/thread.hpp>
    #include <boost/filesystem.hpp>
     
    void runScript()
    {
        Tcl_Interp* pInterp = Tcl_CreateInterp();
     
        std::string sTclPath = boost::filesystem::current_path().string() + "/../../stg/Debug/lib/tcl";
        const char* setvalue = Tcl_SetVar( pInterp, "tcl_library", sTclPath.c_str(), TCL_GLOBAL_ONLY );
        assert( setvalue != NULL );
        int i = Tcl_Init( pInterp );
        assert( i == TCL_OK );
     
        int nTclResult = Tcl_Eval( pInterp, "puts \"Hello\"" );
        assert( nTclResult == TCL_OK );
     
        Tcl_DeleteInterp( pInterp );
    }
     
    int main( int argc, char* argv[] )
    {
        Tcl_FindExecutable(NULL);
     
        runScript();
        runScript();
     
        boost::thread thrd1( runScript );
        thrd1.join(); // works OK
     
        boost::thread thrd2( runScript );
        thrd2.join(); // never joins
     
        return 1;
    }

    Le second thread ne se termine jamais parce que Tcl_CreateInterp entre une boucle inifinie (dans TclInitNotifier(void)).

    Est-ce un problème connu?

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    341
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2007
    Messages : 341
    Points : 528
    Points
    528
    Par défaut
    Bonsoir,

    C'est un problème connu et répertorié qui fait l'objet d'un ticket très récent sur la plate-forme de déveleoppement de Tcl-Tk :

    http://core.tcl-lang.org/tcl/tktview...e09323d9e290de

    Il y a quelques pistes pour contourner ce problème en attendant un patch.

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo