Find the answer to your Linux question:
Results 1 to 5 of 5
Friends I'm starting to learn multithread programming in Linux, I'm using C programming language. Besides the default in Unix systems is pthread (based in POSIX), I do want to write ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2005
    Posts
    9

    Multithreading: which library to make it portable?


    Friends

    I'm starting to learn multithread programming in Linux, I'm using C programming language. Besides the default in Unix systems is pthread (based in POSIX), I do want to write programs that are portable between Linux and Windows.

    I also learned that POSIX support in Windows is non-existent (well, 'it's not a bug, it's a feature') an addon just to make Windows more atractive in those 'feature lists'.

    An issue that arrived is related to several ways to do it: you can use GLib, CommonC++, wxWidgets (which does have some threading functions, but for non GUI apps is overkill), and so on...

    I think that the program being a GUI app or not will have an impact in choosing a library (so I'm currently wondering in non-GUI programs, command line oriented apps cases).

    I'm aware that I could too port POSIX programs to Windows using Cygwin, but I think it's a problem if you need to install 200MB of software just to make a little 3000LOC C/C++ program to compile and run.

    I'm wondering if someone out there have some experience in writing portable multithread apps and could share his/her experiences to us.


    Best regards


    Savago

  2. #2
    Just Joined!
    Join Date
    Oct 2005
    Location
    Saudi Arabia
    Posts
    5
    Dear Savago

    I have a solution but it's for C++ you can use QThread which is for Qt freamework and it's crossplatform

  3. #3
    Just Joined!
    Join Date
    Oct 2005
    Posts
    9
    hungry-mind

    Thanks for your reply. Using C++ is not a problem 'per si', cause I do think that portability is more important than language purism.

    As a matter of fact, I did used C++ a lot... but lately I prefer the C way: cleaner and no compilation issues.

    I guess that QT is overkill for a non GUI app (CLI oriented program), falling in the case of wxWidgets.

    I will search more and design some experiments to see which library can make the code cleaner and has smaller footprint.


    Savago

  4. #4
    Linux User Stefann's Avatar
    Join Date
    Nov 2004
    Location
    Boise, ID
    Posts
    340
    Quote Originally Posted by Savago
    hungry-mind

    Thanks for your reply. Using C++ is not a problem 'per si', cause I do think that portability is more important than language purism.

    As a matter of fact, I did used C++ a lot... but lately I prefer the C way: cleaner and no compilation issues.

    I guess that QT is overkill for a non GUI app (CLI oriented program), falling in the case of wxWidgets.

    I will search more and design some experiments to see which library can make the code cleaner and has smaller footprint.


    Savago
    Perl has some decent libraries with multi-threading support.
    Nothing is worse than ten penguins fighting over which is better, vi or emacs.
    Registered Linux User #404402
    Finally I'm back on LF after a long while.

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

    glib solution

    Basing on my informations, libglib is portable on Windows platforms, and it has a flexible thread handling.

    Even if GLib has no build-in thread implementation for Windows platforms, you can setup Glib to run any thread implementation: you setup a callback table adn everything will go well... the only point you should check is the Windows thread implementation!!!

    This is a solution, but I think it will take a long time.
    When using Windows, have you ever told "Ehi... do your business?"
    Linux user #396597 (http://counter.li.org)

Posting Permissions

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