[SYCL] Clean up shared events from queues upon reaching a threshold (#3068)
Previously the shared ownership of some events (USM and those without
dependencies) by queues was released only upon calls to
queue::wait/wait_and_throw(). If the application exclusively uses
event::wait() instead, those events will be kept alive until the
destruction of the queue.
The patch addresses this problem by introducing a threshold on shared
events associated with each queue. If that threshold is exceeded upon
adding a new shared event for the queue, its events are queried for
their execution status and the completed ones are released.