Thread: Problem with threads

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    4

    Problem with threads

    I'm not sure exactly where to lock and unlock functions when I am trying to, for example,
    save characters to a file every five secs. Can anyone show me an example of how to use
    threads to save a file every so many seconds.

    Thanks,

    Roddman

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    What thread library?

  3. #3
    Registered User
    Join Date
    Mar 2008
    Posts
    4
    Um... Solaris threads.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    There's example code in the solaris threads documentation here:
    http://docsun.cites.uiuc.edu/sun_doc...init.3thr.html

    You will need to mutex all access to the file and data. Then when you're ready to save, acquire exclusive access to the file and data, then save.

    Consider switching to pthreads if you can. There are a lot more resources for learning pthreads.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  2. Closing threads
    By VirtualAce in forum Windows Programming
    Replies: 8
    Last Post: 01-02-2006, 10:49 AM
  3. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  4. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM
  5. binary tree problem - help needed
    By sanju in forum C Programming
    Replies: 4
    Last Post: 10-16-2002, 05:18 AM