Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Simultaneously reading from a file and serving data

by kennethk (Abbot)
on Feb 27, 2014 at 19:11 UTC ( #1076435=note: print w/ replies, xml ) Need Help??


in reply to Simultaneously reading from a file and serving data

Couple of thoughts:

  • Split the tasks between two processes, and rather than sharing memory, use a shared database. You could even just have a shared file that contains your JSON and flock on updates.
  • Use threads and share the associated datastore (e.g. HoH) between the two using threads::shared
  • Use alarm to implement a timeout on your socket read.

Any of these sound promising?


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re: Simultaneously reading from a file and serving data

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1076435]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2015-07-07 14:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (90 votes), past polls