-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement safe fiber recycling, fixes #753 #754
Conversation
Hm.. the |
Sounds fair, I thought maybe a delegate in the core fiber would do to catch the proper type info there and destroy correctly? |
I remember reading that the delegate would make a GC allocation, so I replaced it by a function reference and a void*. Looks lightweight enough to me and certainly more stable than recycling the data on new connections .. which on my application meant inheriting someone else's account if you didn't have a session id.. xD |
Looks about right, only
|
Reset initialization vector also Added destructor support Changed destructor to function and pointer do not expose TaskDestructor Using static struct for destructors Checking for empty FLSInit
Alright, all good and tested on a web app. Not sure on the long run how it's going to fare though but it looks alright |
fiber.ms_flsInfo[m_id].destroy(fiber.m_fls); | ||
fiber.m_flsInit[m_id] = false; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is usually going to crash. A TaskLocal
will only be destroyed when the thread has ended. However, in that case the event loop has already been quit and CoreTask.getThis()
returns null
. So I'd just remove this.
Apart from the destructor, looks good to merge. |
Remove unsafe TaskLocal destructor Remove bugs
Done |
Okay, thanks! Merging in. |
Implement safe fiber recycling, fixes #753
I couldn't find a zerofill algorithm in D so I had to improvise one. This is rarely even important to do b/c D automatically initializes variables as zero-filled, though TaskLocal variables are already initialized when the fiber comes around again.