add a LOCK in optionsmodel to ApplyProxySettings() #1589

pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:optionsmodel_lock changing 1 files +16 −6
  1. Diapolo commented at 1:43 PM on July 12, 2012: none

    I've never worked with a LOCK() before ... so please help me learning this concept :).

  2. laanwj commented at 2:21 PM on July 12, 2012: member

    Shouldn't you lock all accesses of the proxy settings, not only in the UI code?

    Also, where is cs_proxysettings defined?

  3. add a LOCK in optionsmodel to ApplyProxySettings()
    - fixes #1560
    3336f6db94
  4. Diapolo commented at 2:28 PM on July 12, 2012: none

    @laanwj The bug report made me think the problem needs fixing only in the optionsmodel ... I'm not sure here. The definition was missing in the pull, it's there now.

  5. laanwj commented at 2:30 PM on July 12, 2012: member

    You need a LOCK around every place where the data structure you want to protect is accessed. Defining the critical section locally in a function makes no sense.

  6. Diapolo commented at 2:34 PM on July 12, 2012: none

    I saw this in the code somewhere else, feeling a little dumb now. I don't want to fiddle around further!

    Can we lock proxyInfo and nameproxyInfo in SetProxy() and SetNameProxy()? Where should the CCriticalSection be placed? Or is there one we can re-use?

  7. Diapolo commented at 8:51 PM on July 12, 2012: none

    As this seems not matured, I'll close this for now. Any help here is greatly appreciated :).

  8. Diapolo closed this on Jul 12, 2012

  9. laanwj commented at 12:07 AM on July 13, 2012: member

    I recommend you read up a bit on parallel programming and synchronization primitives (especially mutexes, in this case), it really helps to know the theory here and it's pretty interesting in any case.

  10. Diapolo commented at 6:06 AM on July 13, 2012: none

    Indeed, I'll take a quick tour and try again afterwards ^^.

  11. suprnurd referenced this in commit 169afafd50 on Dec 5, 2017
  12. lateminer referenced this in commit 507f75f80a on May 6, 2020
  13. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me