Coder Social home page Coder Social logo

Add `System.Posix.MessageQueue`. about unix HOT 13 CLOSED

haskell avatar haskell commented on May 20, 2024
Add `System.Posix.MessageQueue`.

from unix.

Comments (13)

chessai avatar chessai commented on May 20, 2024 1

from unix.

argiopetech avatar argiopetech commented on May 20, 2024

Both sys/msg.h and mqueue.h are on the list of "Not Supported" "Unsupported interfaces" headers in Posix.hs. This is in contrast to several headers in the "To be supported" category, so it would appear that message wueurs are blocked for some reason other than lack of volunteers to write an interface. I'm not sure of the rationale for this, but I can look into it.

For the record, can you share a use case that might encourage adoption by the Core Libraries Committee of a patch adding message queues?

from unix.

magthe avatar magthe commented on May 20, 2024

It's a standard IPC method that differ from (named) pipes:

  • They have internal structure (pipes are just about pumping bits)
  • They are priority driven and the queue stays ordered so the oldest message with the highest priority is at the front.
  • The programmer has control over various aspects of the queue, on creation one can set
    • size of queue (number of messages)
    • max size of message
  • It's possible to determine that state of a queue

The use case is of course to allow writing programs in Haskell that communicate via message queues.

from unix.

argiopetech avatar argiopetech commented on May 20, 2024

Good enough for me. I'll put some feelers out on the mailing list to see I can determine why (or if) this was slated not to be implemented.

In the event that there is no compelling reason for us not to merge a patch adding this functionality, would you be willing to submit such a patch?

from unix.

magthe avatar magthe commented on May 20, 2024

Sure, I'd be willing to make an attempt at adding it.

from unix.

argiopetech avatar argiopetech commented on May 20, 2024

Thanks! I am, of course, willing to help verify/integrate, but I'm in the middle of a move and remodel at the moment and can't take the lead.

I've thrown a request for info on the libraries mailing list. Pending a response there, I see no reason not to integrate anything created. Worst case, it could be spun into a new library.

On that note, posix-realtme provides a set of basic wrappers around mqueue.h (realtime message queues), which may help with creating a wrapper around sys/queue.h or even solve your challenge outright.

from unix.

magthe avatar magthe commented on May 20, 2024

mqueue.h is Posix message queues: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html

from unix.

argiopetech avatar argiopetech commented on May 20, 2024

mqueue.h is REALTIME (caps and bold per the spec) message queues. One Haskell binding (recently supported, albeit of "provisional" stability) to that header is provided in posix-realtime.

What I think of as "POSIX Message Queues" is provided by sys/msg.h. There is not currently a Haskell binding to those headers of which I am aware.

Which are you looking for? If the former, a solution exists. If the latter, a solution will need to be built. I'll keep this issue open in either case, as I'm legitimately curious why the unix library has (potentially) chosen not to support either.

from unix.

magthe avatar magthe commented on May 20, 2024

sys/msg.h is commonly called System V message queues (or XSI message queues).

The message queues I'm interested are the ones specified in mqueue.h.

from unix.

argiopetech avatar argiopetech commented on May 20, 2024

Fair enough. Good luck with the bindings in posix-realtime.

Pending the mailing list, I may get in touch with Michal Gajda and see if he would like to have posix-realtime integrated into unix.

from unix.

magthe avatar magthe commented on May 20, 2024

Yes, is there any point in keeping them separate?

(A quick glance shows that the mqueue support in posix-realtime aren't complete :( )

from unix.

argiopetech avatar argiopetech commented on May 20, 2024

Incompleteness would, of course, be a valid reason not to merge posix-realtime into unix. Other than that, or an objection by the author of posix-realtime, I have no personal knowledge of a reason not to merge them; however, there may be a historical reason of which I'm not aware. The "Unsupported interfaces" list was created in 2002 and hasn't seen much modification, while I've only been maintaining unix since earlier this year.

My gut feeling is that the path of least resistance would be to add the missing functionality in posix-realtime's System.Posix.Realtime.MQueue, add that file (and any appropriate tests) to unix, and submit it as a pull request here on Github to both unix and posix-realtime. Worst case scenario, you have a usable local copy. Best case scenario it is accepted into posix-realtime and into unix (again, pending that historical data from the mailing list) and benefits everyone.

from unix.

magthe avatar magthe commented on May 20, 2024

My need for this has disappeared so I'm closing this.

from unix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.