You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

queue.go 430 B

12345678910111213141516171819202122232425262728293031
  1. package fifo
  2. import (
  3. "sync"
  4. )
  5. type Queue struct {
  6. DataList []*IData
  7. mutex sync.Mutex
  8. ResourceType string
  9. }
  10. func (q *Queue) Push(data IData) {
  11. q.mutex.Lock()
  12. defer q.mutex.Unlock()
  13. q.DataList = append(q.DataList, &data)
  14. }
  15. func (q *Queue) Pop() IData {
  16. q.mutex.Lock()
  17. defer q.mutex.Unlock()
  18. if len(q.DataList) <= 0 {
  19. return nil
  20. }
  21. var data = q.DataList[0]
  22. q.DataList = q.DataList[1:]
  23. return data
  24. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.