Small issue with threading

I am using the Chilkat xojo plugin, and from that, the spider.
I am running the spider.CrawlNext inside a thread, and it freeze the whole main thread, the gui is not responsive until the thread exit.
How is that possible?

I never used that class, but from the documentation it says that there is an additional CrawlNextAsync method which is possibly what you should use.
CrawlNext is a synchronous method, and because Xojo threads are not pre-emptive there is no chance for the thread scheduler to yield to another thread while the spider is crawling.

Threads in Xojo are cooperative - not preemptive
In the plugin if it does not yield time back to the Xojo runtime then this can happen

[quote=443909:@Ulrich Bogun]I never used that class, but from the documentation it says that there is an additional CrawlNextAsync method which is possibly what you should use.
CrawlNext is a synchronous method, and because Xojo threads are not pre-emptive there is no chance for the thread scheduler to yield to another thread while the spider is crawling.[/quote]

Thanks, I replaced it with the async call and this seems to have solved the issue.

[quote=443910:@Norman Palardy]Threads in Xojo are cooperative - not preemptive
In the plugin if it does not yield time back to the Xojo runtime then this can happen[/quote]

Thats weird. Xojo should change their threading model. I wont be able to continue using Xojo I guess, it just cant do what I need it to do. Anyway, thanks.

preemptive threads are something that require thread safe frameworks
not all are
and writing code that is safe in preemptive threads is not simple
a lot of times when folks need to do something in a preemptive async manner they spawn a helper application which is much simpler to write since it too then runs as its own process, the OS manages process switching, and you can debug it separately from the rest of the app