If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > as400 vr5.2 Multithreading

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-29-05, 12:24
jwhitt jwhitt is offline
Registered User
 
Join Date: Jan 2005
Posts: 1
Question as400 vr5.2 Multithreading

How can a thread be terminated unconditionally?

I am trying to creating a means of terminating long running DB2 queries on an AS400.

In an attempt to do this I have created a multithread program that runs DB2 queries using two

threads. The first threads creates a semaphore, starts a thread, then waits with a timeout on the

semaphore. The thread function then runs an SQL query the posts a semaphore and

terminates itself.

The problem occurs when the queries takes a long time to run. The parent thread, now unblocked

because of a timeout, tries to terminate the thread using the AS400 Cancel_Thread function.

According to AS400 documentation this function can only terminate threads when the thread

status is cancelable and when the thread function calls Check_Cancel.

When the thread is running an SQL query it cannot call Check_Cancel and cannot be terminated.

How can the SQL be terminated? Without terminating the program? Will terminating the program kill the thread?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On