Re: [Spice-devel] Is it possible to put spice channels into different threads?

2020-06-16 Thread Frediano Ziglio
Hi, I have an old patch on that code that instead checks if there are pending data to send and exit the loop instead of a simple counter. But I think that both solutions are not perfect. The reason is that a channel is either reading or writing. If there's for instance a very big message to

Re: [Spice-devel] Is it possible to put spice channels into different threads?

2020-06-15 Thread 陈炤
Hi, For now I simply used a counter to work around this issue. while (... g_pollable_input_stream_is_readable ) { if (loop > 10) break; } Ugly but seems useful. BR Don At 2020-06-15 20:59:00, "Jakub Janku" wrote: >Hi, > >yes, I think this is a real issue. I feel

Re: [Spice-devel] Is it possible to put spice channels into different threads?

2020-06-15 Thread Jakub Janku
Hi, yes, I think this is a real issue. I feel like I've stumbled across something similar in the past when working on webdav. So yeah, it seems like the channel might get blocked in one direction -- meaning data isn't sent until you read all available data. However, that doesn't mean that other

Re: [Spice-devel] Is it possible to put spice channels into different threads?

2020-06-15 Thread 陈炤
Hi, After debugging, I think my problem is probably not accociated with cooperative multitasking. Here is where spice-gtk read data: /* treat all incoming data (block on message completion) */ while (!c->has_error && c->state != SPICE_CHANNEL_STATE_MIGRATING &&

Re: [Spice-devel] Is it possible to put spice channels into different threads?

2020-06-13 Thread 陈炤
Hi About priority channel, here is my idea: Priority control is added to data sending procedure. Sending level(1 - 3) is initiated to 3, means all data can be sent. 2 means data of level 1 and 2 channels can be sent, and level3 data will not be sent. 1 means only data of level 1 channel can

Re: [Spice-devel] Is it possible to put spice channels into different threads?

2020-06-13 Thread 陈炤
Hi Thanks a lot, that information is very helpful, I will try that. BR Don 在 2020-06-13 14:40:02,"Frediano Ziglio" 写道: Hi, the pattern used in spice-gtk is called cooperative multitasking (see https://en.wikipedia.org/wiki/Cooperative_multitasking), if you add code that is not

Re: [Spice-devel] Is it possible to put spice channels into different threads?

2020-06-13 Thread Frediano Ziglio
Hi, the pattern used in spice-gtk is called cooperative multitasking (see https://en.wikipedia.org/wiki/Cooperative_multitasking ), if you add code that is not cooperative you get what you described. Use coroutine functions to read remote data so the read won't stop other code. If you need to

Re: [Spice-devel] Is it possible to put spice channels into different threads?

2020-06-12 Thread 陈炤
Hi Here is my experiment: I created a new port-channel to transfer data between vdagent and spice-gtk. I used a while loop to send 2kb data to gtk, gtk received and drop the data. In the mean time I used a timer(1ms) to send 2kb data to vdagent. Strange thing is that gtk will continually

Re: [Spice-devel] Is it possible to put spice channels into different threads?

2020-06-12 Thread Marc-André Lureau
Hi On Fri, Jun 12, 2020 at 12:57 PM 陈炤 wrote: > Hi, > > Spice-gtk is now using co-routine to handle different channel connections. > When a channel is handling data, other channels would have to wait, rather > than handling synchronously. That would bring us following issues: > 1. If some

[Spice-devel] Is it possible to put spice channels into different threads?

2020-06-12 Thread 陈炤
Hi, Spice-gtk is now using co-routine to handle different channel connections. When a channel is handling data, other channels would have to wait, rather than handling synchronously. That would bring us following issues: 1. If some less important channels (like usb channels) are transfering