Skip to content

Commit

Permalink
remove cmsync usage (cosmos#1151)
Browse files Browse the repository at this point in the history
<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.
-->

## Overview

ref rollkit/rollkit#1125

remove usage of cmsync in rollkit 

<!-- 
Please provide an explanation of the PR, including the appropriate
context,
background, goal, and rationale. If there is an issue with this
information,
please provide a tl;dr and link the issue. 
-->

## Checklist

<!-- 
Please complete the checklist to ensure that the PR is ready to be
reviewed.

IMPORTANT:
PRs should be left in Draft until the below checklist is completed.
-->

- [ ] New and updated code has appropriate documentation
- [ ] New and updated code has new and/or updated testing
- [ ] Required CI checks are passing
- [ ] Visual proof for any user facing features like CLI or
documentation updates
- [ ] Linked issues closed with keywords

---------

Co-authored-by: Marko Baricevic <markobaricevic3778@gmail.com>
  • Loading branch information
tac0turtle and tac0turtle authored Aug 22, 2023
1 parent b9f02c3 commit 3ae761f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions mempool/clist/clist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ to ensure garbage collection of removed elements.
import (
"fmt"
"sync"

cmsync "github.com/cometbft/cometbft/libs/sync"
)

// MaxLength is the max allowed number of elements a linked list is
Expand All @@ -42,7 +40,7 @@ and there's no reason to serialize that condition for goroutines
waiting on NextWait() (since it's just a read operation).
*/
type CElement struct {
mtx cmsync.RWMutex
mtx sync.RWMutex
prev *CElement
prevWg *sync.WaitGroup
prevWaitCh chan struct{}
Expand Down Expand Up @@ -218,7 +216,7 @@ func (e *CElement) SetRemoved() {
// Operations are goroutine-safe.
// Panics if length grows beyond the max.
type CList struct {
mtx cmsync.RWMutex
mtx sync.RWMutex
wg *sync.WaitGroup
waitCh chan struct{}
head *CElement // first element
Expand Down
4 changes: 2 additions & 2 deletions node/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package node
import (
"fmt"
"math"
"sync"

cmsync "github.com/cometbft/cometbft/libs/sync"
"github.com/libp2p/go-libp2p/core/peer"
)

Expand All @@ -13,7 +13,7 @@ const (
)

type mempoolIDs struct {
mtx cmsync.RWMutex
mtx sync.RWMutex
peerMap map[peer.ID]uint16
nextID uint16 // assumes that a node will never have over 65536 active peers
activeIDs map[uint16]struct{} // used to check if a given peerID key is used, the value doesn't matter
Expand Down

0 comments on commit 3ae761f

Please sign in to comment.