---
title: "Discussion on \"Cool tricks with goroutine\" | Hashnode"
description: "Discussion on \"Cool tricks with goroutine\". Using runtime.Gosched() to force schedule Goroutines\nA goroutine can run and occupy a thread for a long time. This should be avoided by using runtime.Gosched() to force schedule Goroutines to switch context.\npackage main\n\nimport (\n    \"fmt\"\n    \"time..."
url: "https://hashnode.com/posts/cool-tricks-with-goroutine/62b7bda092447c9aed5b8ca1"
---

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

Discussion

# [Cool tricks with goroutine](https://nanacoder.hashnode.dev/cool-tricks-with-goroutine?utm_source=hashnode&utm_medium=feed)

Using runtime.Gosched() to force schedule Goroutines A goroutine can run and occupy a thread for a long time. This should be avoided by using runtime.Gosched() to force schedule Goroutines to switch context. package main import ( "fmt" "time...

Jun 26, 2022 · 2 min read · nanacoder.hashnode.dev  
Read the article

-   [#go](https://hashnode.com/tag/go)
-   [#goroutine](https://hashnode.com/tag/goroutine)

## Written by

[Anh Nhat Tran](https://hashnode.com/@japananh)

@japananh · Hanoi, Vietnam

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

@japananh

Hi, my name is Anh Nhat Tran (Nana). I'm a Backend Developer, a book enthusiast, and a powerlifter. My work mostly focused on web development using Javascript, Go, and SQL.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
