| synopsis || arguments || prev || next |
virtual kdu_codestream attach_to_codestream( int codestream_id, void * thread_handle)
[Declared in "../apps/kdu_server/kdu_serve.h"]
Use this function to gain access to one of the target object's code-streams. The function will return an empty interface (one whose kdu_codestream::exists function returns false) if codestream_id refers to a code-stream which is to be served as a raw meta-data box, or if codestream_id does not belong to any of the ranges returned via get_codestream_ranges.
Otherwise, the returned object provides an interface to an open kdu_codestream, created for reading.
Note carefully, that you should not actually use the code-stream interface without first locking it with the lock_codestream function. This is because multiple kdu_serve objects running in different threads of execution might be attempting to access the object simultaneously.
Note also that the kdu_codestream machinery should have been configured internally to operate in the persistent mode.
You must supply a physical address which is unique to the present thread of execution. This is typically the address of some object owned by the thread. The thread_handle is used to keep track of who has acquired a lock on the code-stream, enabling the lock to be released in the event that the owner detaches from the code-stream without first releasing the lock. This can happen if an error condition caused an exception in the owner of the lock.