コード例 #1
0
static bool 
netpollblock ( PollDesc *pd , int32 mode , bool waitio ) 
{ 
G **gpp , *old; 
#line 328 "C:\Users\gopher\AppData\Local\Temp\1\makerelease745458658\go\src\pkg\runtime\netpoll.goc"
gpp = &pd->rg; 
if ( mode == 'w' ) 
gpp = &pd->wg; 
#line 333 "C:\Users\gopher\AppData\Local\Temp\1\makerelease745458658\go\src\pkg\runtime\netpoll.goc"
for ( ;; ) { 
old = *gpp; 
if ( old == READY ) { 
*gpp = nil; 
return true; 
} 
if ( old != nil ) 
runtime·throw ( "netpollblock: double wait" ) ; 
if ( runtime·casp ( gpp , nil , WAIT ) ) 
break; 
} 
#line 348 "C:\Users\gopher\AppData\Local\Temp\1\makerelease745458658\go\src\pkg\runtime\netpoll.goc"
if ( waitio || checkerr ( pd , mode ) == 0 ) 
runtime·park ( ( bool ( * ) ( G* , void* ) ) blockcommit , gpp , "IO wait" ) ; 
#line 351 "C:\Users\gopher\AppData\Local\Temp\1\makerelease745458658\go\src\pkg\runtime\netpoll.goc"
old = runtime·xchgp ( gpp , nil ) ; 
if ( old > WAIT ) 
runtime·throw ( "netpollblock: corrupted state" ) ; 
return old == READY; 
} 
コード例 #2
0
ファイル: znetpoll_windows_386.c プロジェクト: rosrad/go-rep
static bool
netpollblock ( PollDesc *pd , int32 mode , bool waitio )
{
    G **gpp , *old;
#line 328 "/home/14/ren/source/golang/go/src/pkg/runtime/netpoll.goc"
    gpp = &pd->rg;
    if ( mode == 'w' )
        gpp = &pd->wg;
#line 333 "/home/14/ren/source/golang/go/src/pkg/runtime/netpoll.goc"
    for ( ;; ) {
        old = *gpp;
        if ( old == READY ) {
            *gpp = nil;
            return true;
        }
        if ( old != nil )
            runtime·throw ( "netpollblock: double wait" ) ;
        if ( runtime·casp ( gpp , nil , WAIT ) )
            break;
    }
#line 348 "/home/14/ren/source/golang/go/src/pkg/runtime/netpoll.goc"
    if ( waitio || checkerr ( pd , mode ) == 0 )
        runtime·park ( ( bool ( * ) ( G* , void* ) ) blockcommit , gpp , "IO wait" ) ;
#line 351 "/home/14/ren/source/golang/go/src/pkg/runtime/netpoll.goc"
    old = runtime·xchgp ( gpp , nil ) ;
    if ( old > WAIT )
        runtime·throw ( "netpollblock: corrupted state" ) ;
    return old == READY;
}