Hi, I am writing a plugin that will perform some (relatively) slow actions on an incoming request. My plan is that, rather than having the plugin block waiting for each action to finish, they will launch in separate threads and then send an event to the appropriate TSCont instance to indicate the action is finished.
I know I can use TSContCall to send an event which expects a TSEvent value. But I want to send a custom event, not one of the TSEvent values. As a simple solution I picked one of the TSEvent values that I would never expect to get normally (one of the internal values) and used that to indicate this is a custom event, bundling up the actual event details in the event data object. Does this seem like a reasonable solution? Has anyone done anything like this before? Is there a better method to generate custom events? Additionally, in my prototype I noticed that handling this event appears to happen in the same thread as the TSContCall call (that is, it appears to be synchronous). Is this safe? In particular I am likely to be doing something like calling TSHttpTxnReenable in response to this event. Are there any rules around interacting with transactions on different threads that I would need to be aware of? Or is it simply a matter of guarding access with a mutex as appropriate? Thanks, Jonathan. Jonathan Adams Software Engineer [Telephone] +44 118 903 8610 [Twitter]@clearswift [Clearswift] <http://www.clearswift.com/> 1310 Waterside | Arlington Business Park | Theale | Berkshire | RG7 4SA | United Kingdom RELEASED: Clearswift v4.5 Gateways. Upgrade to the latest Clearswift technology today. Learn more here.<https://www.clearswift.com/training-and-support/migration-and-upgrades> This e-mail and any files transmitted with it are strictly confidential, may be privileged and are intended only for use by the addressee unless otherwise indicated. If you are not the intended recipient any use, dissemination, printing or copying is strictly prohibited and may be unlawful. If you have received this e-mail in error, please delete it immediately and contact the sender as soon as possible. Clearswift cannot be held liable for delays in receipt of an email or any errors in its content. Clearswift accepts no responsibility once an e-mail and any attachments leave us. Unless expressly stated, opinions in this message are those of the individual sender and not of Clearswift. This email message has been inspected by Clearswift for inappropriate content and security threats. To find out more about Clearswift’s solutions please visit www.clearswift.com