1

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"

1
  • 1
    Your answer is correct, but please don't edit your answer into the question. Post it as answer. Note: you could try to load {} sample (without the filename). Commented Dec 17, 2013 at 23:10

1 Answer 1

2

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"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.