runtime: refactor goroutine blocking
The change is a preparation for the new scheduler.
It introduces runtime.park() function,
that will atomically unlock the mutex and park the goroutine.
It will allow to remove the racy readyonstop flag
that is difficult to implement w/o the global scheduler mutex.
http://codereview.appspot.com/6501077/diff/4/src/pkg/runtime/proc.c File src/pkg/runtime/proc.c (right): http://codereview.appspot.com/6501077/diff/4/src/pkg/runtime/proc.c#newcode954 src/pkg/runtime/proc.c:954: void it could be a good idea to document ...
12 years, 7 months ago
(2012-09-03 19:38:08 UTC)
#2
12 years, 6 months ago
(2012-09-04 07:40:14 UTC)
#3
On 2012/09/03 19:38:08, remyoudompheng wrote:
> http://codereview.appspot.com/6501077/diff/4/src/pkg/runtime/proc.c
> File src/pkg/runtime/proc.c (right):
>
> http://codereview.appspot.com/6501077/diff/4/src/pkg/runtime/proc.c#newcode954
> src/pkg/runtime/proc.c:954: void
> it could be a good idea to document the purpose of this function:
>
> runtime·park puts the current goroutine into a waiting state and unlocks...
Done.
> especially if it must become more complex. Could there be an interest in
> defining a
>
> typedef void (*unlockfunc)(void*);
>
> so that the signatures and casts are more readable?
Yeah, the casts are ugly. I've just defined the function as void(*)(Lock*), so
now there is only one cast in select. PTAL.
http://codereview.appspot.com/6501077/diff/7003/src/pkg/runtime/time.goc File src/pkg/runtime/time.goc (right): http://codereview.appspot.com/6501077/diff/7003/src/pkg/runtime/time.goc#newcode33 src/pkg/runtime/time.goc:33: runtime·unlock(&timers); Why did you move the guard outside the ...
12 years, 6 months ago
(2012-09-04 07:57:19 UTC)
#4
http://codereview.appspot.com/6501077/diff/7003/src/pkg/runtime/time.goc File src/pkg/runtime/time.goc (right): http://codereview.appspot.com/6501077/diff/7003/src/pkg/runtime/time.goc#newcode58 src/pkg/runtime/time.goc:58: // The caller must have set g->status and g->waitreason. ...
12 years, 6 months ago
(2012-09-04 10:54:09 UTC)
#7
*** Submitted as http://code.google.com/p/go/source/detail?r=f0a385fd719f *** runtime: refactor goroutine blocking The change is a preparation for ...
12 years, 6 months ago
(2012-09-18 17:15:54 UTC)
#9
*** Submitted as http://code.google.com/p/go/source/detail?r=f0a385fd719f ***
runtime: refactor goroutine blocking
The change is a preparation for the new scheduler.
It introduces runtime.park() function,
that will atomically unlock the mutex and park the goroutine.
It will allow to remove the racy readyonstop flag
that is difficult to implement w/o the global scheduler mutex.
R=rsc, remyoudompheng, dave
CC=golang-dev
http://codereview.appspot.com/6501077
Issue 6501077: code review 6501077: runtime: refactor goroutine blocking
(Closed)
Created 12 years, 7 months ago by dvyukov
Modified 12 years, 6 months ago
Reviewers:
Base URL:
Comments: 6