Threading

This is a discussion on Threading within the C# Programming forums, part of the General Programming Boards category; in the mani thread i have something like Code: while(rt.Running) { switch(rt.State) {..} .. } in my thread class I ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    22

    Threading

    in the mani thread i have something like

    Code:
    while(rt.Running)
    {
      switch(rt.State)
      {..}
    ..
    }
    in my thread class I have something like
    Code:
    public t_State State;
    public bool bIsRunning;
    these varianbles are set/canged in various places in the threading code.

    Is this ok like this?(doesn't seem to work, my program locks up..)

    Do I have to lock access to each variable before using it?

    Thanks

  2. #2
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    Let's see the rest of your code.

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    Do I have to lock access to each variable before using it?
    Short version ? Yes.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. c++ threading
    By Anddos in forum C++ Programming
    Replies: 4
    Last Post: 12-28-2005, 03:29 PM
  2. C++ Threading?
    By draggy in forum C++ Programming
    Replies: 5
    Last Post: 08-16-2005, 01:16 PM
  3. Problem with threading
    By osal in forum Windows Programming
    Replies: 6
    Last Post: 07-21-2004, 01:41 PM
  4. starting to learn multi threading
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 06-09-2004, 02:44 PM
  5. Threading
    By threads in forum C# Programming
    Replies: 0
    Last Post: 01-17-2003, 11:50 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21