[Spread-users] spread as a shared library?

John Schultz jschultz at d-fusion.net
Thu Jun 30 12:52:28 EDT 2005


Neil Conway wrote:
> I'm working on an application that will use Spread. However, I don't 
> really need a separate Spread daemon process AFAICS: each node in the 
> group will only have a single connection to Spread. I'd also rather not 
> burden my users with the need to install and configure the Spread daemon.
> 
> I'm wondering if it would be possible to refactor Spread to provide a 
> shared library that implements the Spread protocol. An application 
> linking against the Spread library would need to call into Spread's 
> event loop regularly (or perhaps just dedicate a thread to this task and 
> have it block inside the Spread event loop). The spread daemon could 
> then be implemented using this library.
> 
> Does this sound feasible? It would obviously require some fairly major 
> surgery, I'm just wondering if there's some reason it's not possible.
> 
> -Neil
> 

Here's a simple approach that MIGHT work, although I give no guarantees 
at all.  Change Spread's main() fcn into a thread entry function.  In 
that thread entry function do whatever signal blocking is appropriate to 
shield that thread from unwanted signals.  Spawn a thread to execute 
that function.  Then connect to Spread just as if it was running in 
another process.

The only problems I can see with this is that (a) you can only run 1 
Spread thread within your process (not really a problem) and (b) you'll 
need to do some fudging with the code because I think the spread client 
library and spread code themselves clash somewhat.  But if you can get 
them to co-exist, then I think this simple approach could work.

-- 
John Schultz
Co-Founder, Lead Engineer
D-Fusion, Inc. (http://www.d-fusion.net)
Phn: 443-838-2200 Fax: 707-885-1055





More information about the Spread-users mailing list