3 ms·
Would `volatile` help with the barrier? Re the multi-threading issue, it should be possible to stop the profiler thread in the hook, if we keep a reference to
by brewmarche 4y ago
Would `volatile` help with the barrier?
Re the multi-threading issue, it should be possible to stop the profiler thread in the hook, if we keep a reference to the thread, no?
- aardvark179 4y agoThe fields are final, so they can't be volatile. :-) Using one of the fence methods on VarHandles would ensure the correct ordering. To stop the profiler thread it would be best to provide a controlled method of doing it, there's a lot of way it can be implemented but you probably want to signal it in some way and then do a join() to wait while it shuts down cleanly.
- parttimenerd 4y agoThanks, I implemented it using a boolean flag.