Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: Map Key "sync" Ulock Rlock #21050

Closed
joelurtubia opened this issue Jul 17, 2017 · 4 comments
Closed

sync: Map Key "sync" Ulock Rlock #21050

joelurtubia opened this issue Jul 17, 2017 · 4 comments

Comments

@joelurtubia
Copy link

joelurtubia commented Jul 17, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

version 1.8

What operating system and processor architecture are you using (go env)?

raspberry Pi
NOOBS
Version:2.4.2

What did you do?

I've capture multicast with a socket program based on Go, and analyze this traffic with go functions...
each frame multicast generate 7 Transporstream data with each distinct header

attached a picture where explain each TransporStream data

image

the problem is for each TS i need to read and re-write information online , for each data that I've recibed... I've read and write with header information, the problem was that has an issue with map key function, but is solved with sync library, but for my program, this sync library was very slow , the program can't catch all parameters , then into my console log doesn't show me any data, because I think is blocked for sync fuction,....also data input is a lot ... each frame arrive on 0.8 ms.

here is part of my code where I see that the problem appears, when I try to get new parameters on switch loop.

            PID,Scrambled,CCerr := GetHeaderTS(Split,f,l)
           
            
             CompareKeyValue(PID) 
            //time.Sleep(1 * time.Millisecond)
            //PidCCerrLock.RLock()
            //defer PidCCerrLock.RUnlock()
            log.Println("Old map:", PidCCerr)
            //delete(PidCCerr, PID);
            //time.Sleep(1 * time.Millisecond)
            PidCCerrLock.Lock()
            defer PidCCerrLock.Unlock()
            PidCCerr[PID] = CCerr   
            log.Println("New map:", PidCCerr)

What did you expect to see?

I use PHP for socket programming, instendent of go and , use the same fuctionality withouth no errors, I expect that go should be more faster that PHP and works to see more faster and not need to use Lock and Unlock fuctions for generate more slower my program.

What did you see instead?

I saw many

thanks for your help, I'm a bit new on Go, but I would like to learn it because is very similar to "C" and more faster than PHP and python...
thanks for your help, and very sorry if you not understand all that write here, my english isn't very good.

@bradfitz
Copy link
Contributor

For questions about Go, see https://golang.org/wiki/Questions.

We only use this issue tracker for bugs, not for general Q&A.

@joelurtubia
Copy link
Author

joelurtubia commented Jul 17, 2017

ok... Brad, I understood, but Map Key sync functionality has a problem, is very slow , and block and unblok the map key is not a solution , how can you fix that?

@bradfitz
Copy link
Contributor

The mailing list or Slack or forums are the right places to get help with Go problems.

@joelurtubia
Copy link
Author

ok ...thanks Brad

@mikioh mikioh changed the title Map Key "sync" Ulock Rlock sync: Map Key "sync" Ulock Rlock Jul 21, 2017
@golang golang locked and limited conversation to collaborators Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants