There's no equivalent of the methods you mentioned. You can't limit a goroutine from another goroutine, because (among other reasons) there's no way to name it. A goroutine can limit itself a bit by calling runtime.Gosched, or more forcefully using time.Timer. Andrey's suggestion of limiting how fast you feed it work is also a good idea.
On Wednesday, August 15, 2018 at 8:42:18 PM UTC-7, andrey mirtchovski wrote: > > it seems from your suggested solutions that you're concerned about cpu > usage. does the goroutine communicate with anything? you can limit its > resources by feeding it less data (via a limiter goroutine) or by > editing it itself do less work (via editing the code)? there is > nothing inherently needed from the operating system to throttle it, it > can all be done via go communication patterns. for example we often > limit how much work can be done by using a n-sized buffered channel > that ensures only n items are processed at a certain time. > On Wed, Aug 15, 2018 at 9:29 PM Olivia Nelson > <the.warl...@gmail.com <javascript:>> wrote: > > > > I'm trying to limit the CPU usage of a goroutine. Is there anything like > SuspendThread on windows and SIGSTOP/SIGCONTINUE on linux? > > > > I'm not sure if it's possible. > > > > -- > > You received this message because you are subscribed to the Google > Groups "golang-nuts" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to golang-nuts...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.