Reputation: 189
I'm trying to move some processing of a report to a different tcl thread apart from the main thread, since when a report is very long it stalls the main application, i have some C functions that i need to call from this new thread that return a variable that is need it. This is what i'm trying to do as of right now
Tcl code:
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
}
as of right now i get invalid command name "getAlarmList"
Upvotes: 1
Views: 96
Reputation: 189
I think I found a way to do it, I guess the new thread doesn't know about the C library so if I load the library where the C function is then it recognizes the command so something like this:
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"
Upvotes: 2