Re: Plans for gnome-vfs replacement
- From: Tim Janik <timj imendio com>
- To: Alexander Larsson <alexl redhat com>
- Cc: Paolo Borelli <pborelli katamail com>, "gtk-devel-list gnome org" <gtk-devel-list gnome org>, Paolo Maggi <paolo gnome org>, "gnome-vfs-list gnome org" <gnome-vfs-list gnome org>
- Subject: Re: Plans for gnome-vfs replacement
- Date: Mon, 25 Sep 2006 11:40:04 +0200 (CEST)
On Wed, 20 Sep 2006, Alexander Larsson wrote:
Here is my current GInputStream:
struct _GInputStreamClass
{
GObjectClass parent_class;
/* Sync ops: */
gssize (* read) (GInputStream *stream,
void *buffer,
gsize count,
GError **error);
gssize (* skip) (GInputStream *stream,
gsize count,
GError **error);
gboolean (* close) (GInputStream *stream,
GError **error);
/* Async ops: (optional in derived classes) */
guint (* read_async) (GInputStream *stream,
void *buffer,
gsize count,
int io_priority,
GMainContext *context,
GAsyncReadCallback callback,
gpointer data,
GDestroyNotify notify);
guint (* close_async) (GInputStream *stream,
GMainContext *context,
GAsyncCloseCallback callback,
gpointer data,
GDestroyNotify notify);
void (* cancel) (GInputStream *stream,
guint tag);
}
GInputStream objects can optionally also implement the GSeekable
interface to support seeking and truncating. This is your basic
syncronous read API with an addition of some async calls. If a derived
class doesn't implement the async calls the baseclass will emulate them
using threads (similar to how gnome-vfs works now). GOutputStream is
similar, without the skip method, but with a flush method added.
hm, in your initial proposal, you said that apps don't currently have control
over whether they want to use/care about threading or not. so, are you
planning for a way to use the GVFS API without threading under the hood?
then, emulation of the above asny calls would be implemented in terms of
IO handlers attached to the provided GMainContext *context?
and, does it really make sense to have individual GMainContexts per
async operations?
since you have a statefull object already, wouldn't something
like this be better:
void g_input_stream_set_async_context (GInputStream *stream,
GMainContext *context);
void g_input_stream_async_read (GInputStream *stream,
uint8 *buffer,
...);
i.e. here you'd essentially force users to set_async_context() before
any of the g_input_stream_async_*() ops could be called.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl redhat com alla lysator liu se
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]