Cfthread nested threads?

I have a function that runs an infinite loop,ongoing process which is started using cfthread. Is it possible to create a cfthread within a cfthread?

Im asking this because the loop is not asynchronous. but i want to kick off another process that wont block the loop from continuing.

Basicaly my loop is checking for a condition. and when the event happens. i want to write a file or http post. but i dont want to wait for the file write or the http to finish to keep checking.

What would be the best approach here.

Thanks for your input.

have you considered using an event gateway?

http://docs.lucee.org/guides/Various/event-gateway.html

https://lucee.daemonite.io/t/lucee-event-gateways/2066

2 Likes

That’s a good suggestion. I have been considering that. I haven’t ever written an event gateway so I might try that next.

I know cf thread was a feature that came out after event gateways ad threads seem really simple so I figured I would try that 1st.

Do you think I can accomplish my goal with an event gateway? Any disadvantages to them?