On 3/23/2012 4:53 PM, Phil Stracchino wrote:
> On 03/23/2012 04:19 PM, Josh Fisher wrote:
>> I think there has to be some sort of communication, and the thread doing
>> the append_data() has got to wait and find out if the spool manager
>> actually managed to write the data to tape, which is quite a bit
>> different than the current way.
>
> I see your point.  Clearly there has to be communication of the whole
> process, yes.  It is only reasonable that each spool file would be
> tagged with the JobId it belongs to, and if the "available for
> despooling" flag were accompanied by a "final segment" flag, then upon
> completing that final segment (or failing to completely write any
> segment), the spool manager can send a message back to the job thread
> saying either "Job successfully completed" or "Job failed".

That sounds reasonable. A Pthreads condition variable should do nicely. 
The thread talking to the FD can pthread_cond_wait() on the condition 
variable, and the spool manager thread can pthread_cond_signal() when it 
has finished writing the spool file that has the "final segment" flag 
set. That will keep the thread in a wait state and avoid polling.


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to