So something like this:

while (!plugin_threads.empty()) {

      TSThread th = plugin_threads.front();

      // Cancel the threads, then call join to make sure they actually are
stopped.
      TSThreadCancel(th);
      TSThreadJoin(th);

      plugin_threads.pop();
}

On Thu, Feb 28, 2019 at 2:55 PM Fei Deng <f...@verizonmedia.com> wrote:

> Use case right now is for the ssl_session_reuse plugin, it's crashing
> during shutdown and the reason is one or more thread of it is lingering
> just a bit too long and with openssl-1.1.1 it will crash. The current way
> is to set a flag but there are threads that sleeps up to 30 seconds, or if
> the timing is really bad might just started calling stuff in openssl, so
> the shutdown flag won't be enough. With the cancel, we can just terminate
> the thread on the spot. The TSThreadSetCancelState
> and TSThreadSetCancelType are really just to make sure TSThreadCancel can
> terminate a thread, I can find a way to hide them.
>
> On Thu, Feb 28, 2019 at 2:43 PM Leif Hedstrom <zw...@apache.org> wrote:
>
>>
>>
>> > On Feb 28, 2019, at 9:17 AM, Fei Deng <duke8...@apache.org> wrote:
>> >
>> > void TSThreadSetCancelState(TSThread thread, int state);
>> > void TSThreadSetCancelType(TSThread thread, int type);
>> > void TSThreadCancel(TSThread thread);
>> > void *TSThreadJoin(TSThread thread);
>>
>>
>> That’s a lot of APIs for something that sounds “simple”. Can you provide
>> an example how all these APIs would be used?
>>
>> — leif
>>
>>

Reply via email to