reentrant_lock.go 564 B

12345678910111213141516171819202122232425262728
  1. package lock
  2. import (
  3. "context"
  4. "github.com/go-redis/redis/v8"
  5. "sync"
  6. )
  7. type RedisReentrantLock struct {
  8. key string
  9. client *redis.UniversalClient
  10. ctx context.Context
  11. identity string
  12. count int
  13. mu sync.Mutex
  14. stopChan chan struct{}
  15. }
  16. //func NewRedisReentrantLock(client *redis.Client, ctx context.Context, key string, identity string) *RedisReentrantLock {
  17. // return &RedisReentrantLock{
  18. // key: key,
  19. // client: client,
  20. // ctx: ctx,
  21. // identity: identity,
  22. // count: 0,
  23. // stopChan: make(chan struct{}),
  24. // }
  25. //}