Skip to content

Commit

Permalink
add linear go to skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
name5566 committed May 28, 2015
1 parent 12185a6 commit 69d6435
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions go/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ func (c *LinearContext) Go(f func(), cb func()) {
defer c.mutexExecution.Unlock()

c.mutexLinearGo.Lock()
lg := c.linearGo.Remove(c.linearGo.Front()).(*LinearGo)
e := c.linearGo.Remove(c.linearGo.Front()).(*LinearGo)
c.mutexLinearGo.Unlock()

lg.f()
c.g.ChanCb <- lg.cb
e.f()
c.g.ChanCb <- e.cb
}()
}
8 changes: 8 additions & 0 deletions module/skeleton.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ func (s *Skeleton) Go(f func(), cb func()) {
s.g.Go(f, cb)
}

func (s *Skeleton) NewLinearContext() *g.LinearContext {
if s.GoLen == 0 {
panic("invalid GoLen")
}

return s.g.NewLinearContext()
}

func (s *Skeleton) RegisterChanRPC(id interface{}, f interface{}) {
if s.ChanRPCServer == nil {
panic("invalid ChanRPCServer")
Expand Down

0 comments on commit 69d6435

Please sign in to comment.