Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. About lock

About lock

Scheduled Pinned Locked Moved C#
csharphelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bob_Sun
    wrote on last edited by
    #1

    I have a problem about lock in C#. I have written a multithread program, but the other day, the program hung up suddenly. I have checked the code throughly but i could find nothing wrong. In order to realize sync., i use lock(this) at several places. But to my dismay, i was told this is not a good way at all recently. Can anyone give me some information about this? Thank you -- modified at 6:57 Friday 24th March, 2006

    G 1 Reply Last reply
    0
    • B Bob_Sun

      I have a problem about lock in C#. I have written a multithread program, but the other day, the program hung up suddenly. I have checked the code throughly but i could find nothing wrong. In order to realize sync., i use lock(this) at several places. But to my dismay, i was told this is not a good way at all recently. Can anyone give me some information about this? Thank you -- modified at 6:57 Friday 24th March, 2006

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Who told you that it wasn't a good way, and what was the arguments for that? Locking should of course be kept as a minimum, and to avoid deadlocks a thread should never lock more than one object at a time. Still, for sharing data between threads there is hardly any alternative. --- b { font-weight: normal; }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups