Commit 2ea859a7 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

runtime: refactor level-triggered IO support

Remove GOOS_solaris ifdef from netpoll code,
instead introduce runtime edge/level triggered IO flag.
Replace armread/armwrite with a single arm(mode) function,
that's how all other interfaces look like and these functions
will need to do roughly the same thing anyway.

LGTM=rsc
R=golang-codereviews, dave, rsc
CC=golang-codereviews
https://golang.org/cl/55500044
parent e1ee0482
......@@ -134,12 +134,9 @@ ret:
func runtime_pollWait(pd *PollDesc, mode int) (err int) {
err = checkerr(pd, mode);
if(err == 0) {
#ifdef GOOS_solaris
if(mode == 'r')
runtime·netpollarmread(pd->fd);
else if(mode == 'w')
runtime·netpollarmwrite(pd->fd);
#endif
// As for now only Solaris uses level-triggered IO.
if(Solaris)
runtime·netpollarm(pd->fd, mode);
while(!netpollblock(pd, mode, false)) {
err = checkerr(pd, mode);
if(err != 0)
......@@ -152,13 +149,8 @@ func runtime_pollWait(pd *PollDesc, mode int) (err int) {
}
func runtime_pollWaitCanceled(pd *PollDesc, mode int) {
#ifdef GOOS_solaris
if(mode == 'r')
runtime·netpollarmread(pd->fd);
else if(mode == 'w')
runtime·netpollarmwrite(pd->fd);
#endif
// wait for ioready, ignore closing or timeouts.
// This function is used only on windows after a failed attempt to cancel
// a pending async IO operation. Wait for ioready, ignore closing or timeouts.
while(!netpollblock(pd, mode, true))
;
}
......
......@@ -52,6 +52,13 @@ runtime·netpollclose(uintptr fd)
return -res;
}
void
runtime·netpollarm(uintptr fd, int32 mode)
{
USED(fd, mode);
runtime·throw("unused");
}
// polls for ready network connections
// returns list of goroutines that become runnable
G*
......
......@@ -59,6 +59,13 @@ runtime·netpollclose(uintptr fd)
return 0;
}
void
runtime·netpollarm(uintptr fd, int32 mode)
{
USED(fd, mode);
runtime·throw("unused");
}
// Polls for ready network connections.
// Returns list of goroutines that become runnable.
G*
......
......@@ -72,6 +72,13 @@ runtime·netpollclose(uintptr fd)
return 0;
}
void
runtime·netpollarm(uintptr fd, int32 mode)
{
USED(fd, mode);
runtime·throw("unused");
}
// Polls for completed network IO.
// Returns list of goroutines that become runnable.
G*
......
......@@ -893,8 +893,7 @@ int32 runtime·netpollopen(uintptr, PollDesc*);
int32 runtime·netpollclose(uintptr);
void runtime·netpollready(G**, PollDesc*, int32);
uintptr runtime·netpollfd(PollDesc*);
void runtime·netpollarmread(uintptr fd);
void runtime·netpollarmwrite(uintptr fd);
void runtime·netpollarm(uintptr, int32);
void runtime·crash(void);
void runtime·parsedebugvars(void);
void _rt0_go(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment