2013-12-17 60 views
1

我想移动一些报告处理的一个不同的TCL线程除了主线程,因为当一个报告是非常长的它阻止主应用程序,我有一些C函数,我需要从这个新的线程调用,返回一个需要它的变量。这就是我想要多线程调用函数定义在C从TCL线程

Tcl的代码做截至目前:

proc pdfthread {} \ 
{ 
    set threadID [thread::create] 
    set result "" //"getAlarmList" is the C function the rest is the parameters 
    thread::send $threadID [list getAlarmList 304 {2013-10-16 15:10:26} {2013-10-16 15:13:00}] result 
    .sumRepTxt insert end "Count = $result\n" //.sumRepTxt is just a text widget 
} 

截至目前,我得到无效的命令名称“getAlarmList”

+1

你的答案是正确的,但请不要编辑你的答案进入问题。发布它作为答案。注意:你可以尝试'加载{} sample'(没有文件名)。 –

+0

会做,谢谢 –

回答

2

我想我找到了一种方法来做到这一点,我想新的线程不知道C库,所以如果我加载库所在的C函数则其识别命令所以是这样的:

proc pdfthread {} \ 
{ 
    set threadID [thread::create { 
        load ./samples.so 
        thread::wait}] 
    set result "" 
    thread::send $threadID [list getAlarmList 304 {2013-10-16 15:10:26} {2013-10-16 15:13:00}] result 
    .sumRepTxt insert end "Count = $result\n"