1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Kernel: Refine lazy sweep resource.

This commit is contained in:
winlin 2022-10-04 20:47:49 +08:00
parent eb04f92176
commit d4ce877407
4 changed files with 22 additions and 22 deletions

View file

@ -50,7 +50,7 @@ public:
// Lazy-sweep resource, never sweep util all wrappers are freed.
// See https://github.com/ossrs/srs/issues/3176#lazy-sweep
class ISrsLazyResource : public ISrsResource
class SrsLazyObject
{
private:
// The reference count of resource, 0 is no wrapper and safe to sweep.
@ -61,13 +61,13 @@ private:
// All available wrappers.
std::vector<ISrsResource*> gc_wrappers_;
public:
ISrsLazyResource();
virtual ~ISrsLazyResource();
SrsLazyObject();
virtual ~SrsLazyObject();
public:
// For wrapper to use this resource.
virtual ISrsLazyResource* gc_use(ISrsResource* wrapper);
virtual SrsLazyObject* gc_use(ISrsResource* wrapper);
// For wrapper to dispose this resource.
virtual ISrsLazyResource* gc_dispose(ISrsResource* wrapper);
virtual SrsLazyObject* gc_dispose(ISrsResource* wrapper);
// The current reference count of resource.
virtual int32_t gc_ref();
public:
@ -89,7 +89,7 @@ public:
virtual ~ISrsLazyGc();
public:
// Remove then free the specified resource.
virtual void remove(ISrsLazyResource* c) = 0;
virtual void remove(SrsLazyObject* c) = 0;
};
#endif