My intent for the makearray method was for it to remove the lines from queue, not leave them in. The intent here is to be able to use a DO OVER loop to iterate over the lines in the queue. So remove the line that put it back. I'd also recommend making just a single call to queued with a temporary variable. Since that has to make an interprocess call to the queue server, that can be sort of an expensive operation.
The guarded is not sufficient to protect the queue, which can be accessed not just from another thread, but also from another PROCESS. Guarded is the default behavior, so adding that doesn't really do anything. I'm not too worried about another thread/process writing information to the queue. For that situation, just query the number of lines and return that many lines as a snapshot. It is possible that another thread or process might remove lines while the loop is executing. If the loop doesn't end up finding a line in the queue when pull() is called, .nil we be returned. You can use that to just terminate reading and return whatever you have. In practice, this is not likely to to be any more of a problem than the equivalent loop that people normally use for reading command output that has been captured with the RXQUEUE pipe filter. Rick On Wed, Aug 13, 2008 at 2:01 AM, Sahananda (Jon) Wolfers <[EMAIL PROTECTED]> wrote: > The approach I am thinking of taking for the makearray is this: > > /* ------------------------------------------------------------------------- > */ > ::method makearray guarded > /* ------------------------------------------------------------------------- > */ > arr = .array~new(self~queued) > do i = 1 to self~queued > line = self~pull > arr[i]=line > self~queue(line) > end /* DO */ > return arr > > which in itself seems reasonable enough and leaves the RexxQueue in the > state it started in, but what I am wondering is whether the guarded is > sufficient to prevent the rxqueue device writing to the queue through the > API from a concurrent thread whilst it is being cycled through? > > I'm not sure how I would test for this. > > thanks > > Jon > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Oorexx-devel mailing list > Oorexx-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/oorexx-devel > > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel