home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 263,943 of 264,096   
   Dan Cross to arne@vajhoej.dk   
   Re: more CMA   
   08 Dec 25 20:55:36   
   
   From: cross@spitfire.i.gajendra.net   
      
   In article <69345887$0$663$14726298@news.sunsite.dk>,   
   Arne Vajhøj   wrote:   
   >On 12/4/2025 3:59 PM, Arne Vajhøj wrote:   
   >> On 12/4/2025 2:49 PM, Simon Clubley wrote:   
   >>> 1) What is the reason for using the CMA interface instead of the pthread   
   >>> interface ? If there is no specific reason, perhaps rewriting it as a   
   >>> pthreads application might give some clues.   
   >>   
   >> I already have working pthreads code.   
   >>   
   >> I wanted to do the same with cma.   
   >   
   >There are something in cma not present in pthread.   
   >   
   >The cma API comes with the cma_lib_queue_* functions.   
      
   Presumably this doesn't exist in pthreads because it's simple to   
   do oneself using the tools that interface gives you (mutexes and   
   condition variables, specifically).   
      
   For example, I whipped this up earlier today as a demonstration:   
   https://github.com/dancrossnyc/cqueue/blob/main/cqueue.c   
      
   (The `try_*` implementations left as an exercise for the reader;   
   they are very simple, but I just could't be bothered.)   
      
   Nothing in the CMA lib APIs strikes me as particularly worth   
   adding it to the interface, and one can imagine all sorts of   
   enhancements that it just doesn't provide (prioritization;   
   fairness; sending by value instead of reference, etc).   
      
   For non-trivial applications, I imagine the pthreads folks   
   decided that it was probably better to do it yourself, or find   
   a third-party library better suited to the specific use case.   
      
   >Doing similar to java.util.concurrent.BlockingQueue   
   >if you are familiar with that.   
      
   Well, not quite.  That's generic over some element type, E.  The   
   CMA library functions, and my own trivial example, just use a   
   pointer, which is rather different.   
      
   	- Dan C.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca