Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- /*
- static int x = 1;
- static void
- do_work() {
- while (1) {
- x = 2 * x;
- }
- }
- */
- import "C"
- import (
- "log"
- "os"
- "sync"
- "github.com/yerden/go-dpdk/eal"
- )
- var crc uint32 = 1
- func main() {
- if _, err := eal.Init(os.Args); err != nil {
- log.Fatalln("EAL init failed:", err)
- }
- defer eal.Cleanup()
- defer eal.StopLcores()
- var wg sync.WaitGroup
- for _, id := range eal.LcoresWorker() {
- wg.Add(1)
- go eal.ExecOnLcore(id, func(*eal.LcoreCtx) {
- defer wg.Done()
- id := eal.LcoreID()
- if id%2 == 0 {
- C.do_work()
- }
- for {
- crc = 2 * crc
- }
- })
- }
- wg.Wait()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement