Find the answer to your Linux question:
Results 1 to 5 of 5
I'm a windows programmer, trying out Linux programming. I'm trying to recreate what I do in multithreaded windows applications in Linux, and it just doesn't seem to be working. In ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2005
    Posts
    5

    High Level Linux NEWB Threading Question?


    I'm a windows programmer, trying out Linux programming. I'm trying to recreate what I do in multithreaded windows applications in Linux, and it just doesn't seem to be working.

    In a windows multithreaded application I would create a controller thread that consumes a queue, and blocks on reading that queue. I would also create a thread implimented as a timer that would make up every n milliseconds and check a sorted list of events and then place the expired events onto the controller queue.

    In Linux this doesn't seem possible. Linux's support for worker threads and mutexs seems pretty good, but timers seems to not exist outside of device drivers. I'm programming in the user space, so timer_list is unavailable. Does Linux really not support timers in any way? Up till this point I've been really impressed with Linux.

    Thanks in advance,
    Ben

  2. #2
    Linux Enthusiast
    Join Date
    Dec 2004
    Posts
    577
    I am really not sure, what language are you using, I think Linux supports timers

  3. #3
    Just Joined!
    Join Date
    Nov 2005
    Posts
    5
    I'm C/C++, but as far as I've seen only writing applications within the system space, not user space supports timers. There is alarm(int seconds), but having a minimum of 1 second intervals doesn't satisfy the granularity I'm looking for.

  4. #4
    Linux User
    Join Date
    Aug 2005
    Location
    Italy
    Posts
    401

    Glib

    For high level thread managament (main loop, timer callbacks...) you should check glib-2.x.x, General library, wich are the basement of GTK+ libraries. Have a nice documentation and can do everything you need.

    This is a good solution. Probably there are many others...
    When using Windows, have you ever told "Ehi... do your business?"
    Linux user #396597 (http://counter.li.org)

  5. #5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •