Starting and managing threads
Ali Çehreli
acehreli at yahoo.com
Sat Jan 15 23:42:03 UTC 2022
On 1/12/22 00:50, Bagomot wrote:
> If I change the run method of the Guard class so that it starts a new
> thread, the program just does nothing:
> ```d
> public void run() {
> spawn((shared EventLoop eventLoop) {
> while ((cast() eventLoop).loop()) {
> continue;
The program does nothing probably because of that continue. (?)
> }
> }, cast(shared) this.eventLoop);
> }
So, the event loop is in a separate thread. What should happen when the
events trigger? Do you want this thread to handle the events or should
this thread send a message to the main thread (or perhaps a separate
thread that responds to these events).
Ali
More information about the Digitalmars-d-learn
mailing list