[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-developers] W32 console woes

From: LRN
Subject: [GNUnet-developers] W32 console woes
Date: Tue, 07 Jan 2014 20:40:55 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Thunderbird/29.0a1

Hash: SHA1

With gnunet-conversation we now have an application with interactive
console UI. Which requires selecting on a console.
Skip to the last paragraph for the important part.

I have found no way to wait (and thus select) on a console handle.
Thus it will have to be done with a thread.
That thread could work the same way the socket-selecting thread works
(except that it will only wait for a single console, not for a set of
them) - i.e. it will be woken when selecting is needed, then it will
block on a read, and will either unblock and wake up everyone else, or
keep blocking, in which case the main thread will force it to unblock
by simulating a console write; then the waiter thread will go to sleep
until the next select call.

OR it could be implemented as a constantly-working thread that just
always reads from console, puts read data into a buffer and maintains
an event object that is set as long as there are events in the buffer,
thus allowing the main thread to just wait on that event.

The advantage of the second way is that it doesn't have a hacky wakeup
mechanism of the first way. That mechanism may eat input events (if
the user presses something between the main thread waking up on
timeout and generating a fake input event, then the waiter will
discard actual user input and leave the fake one in the queue).
The disadvantage of the second way is that it involves having a
thread, which is something grothoff absolutely does not want to have,
even if it's only for W32.

Which leads me to the question: do we really need interactive console
on Windows? Maybe it's better to just make a simple gtk+-based
conversation app and use that for testing purposes instead of
gnunet-conversation (i sincerely hope that gnunet-conversation IS for
testing purposes only, not for real end-users)?

- -- 
O< ascii ribbon - stop html email! -
Version: GnuPG v1.4.11 (MingW32)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]