---
title: "Discussion on \"Pattern 4: Condition Variables for Waiting on Shared State\" | Hashnode"
description: "Discussion on \"Pattern 4: Condition Variables for Waiting on Shared State\". package main\n\nimport (\n    \"fmt\"\n    \"sync\"\n    \"time\"\n)\n\ntype DataStore struct {\n    data  []int\n    ready bool\n    mu    sync.Mutex\n    cond  *sync.Cond\n}\n\nfunc NewDataStore() *DataStore {\n    ds := &DataStore{\n        data:  make([]int, 0),\n      ..."
url: "https://hashnode.com/posts/pattern-4-condition-variables-for-waiting-on-shared-state/690682f1a52348a9bcf2107b"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Pattern 4: Condition Variables for Waiting on Shared State](https://hey-there.hashnode.dev/pattern-4-condition-variables-for-waiting-on-shared-state?utm_source=hashnode&utm_medium=feed)

package main import ( "fmt" "sync" "time" ) type DataStore struct { data \[\]int ready bool mu sync.Mutex cond \*sync.Cond } func NewDataStore() \*DataStore { ds := &DataStore{ data: make(\[\]int, 0), ...

Nov 1, 2025 · 2 min read · hey-there.hashnode.dev  
Read the article

## Written by

[20DIT021 BHASHKAR DHRUV](https://hashnode.com/@dhruv1812)

@dhruv1812

  
[View profile](https://hashnode.com/@dhruv1812)

embrace the imposter syndrome

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
