[Top][All Lists]

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

[cybop-developers] Fwd: Re: [Xcb] Feature Request: Function "xcb_test_fo

From: Christian Heller
Subject: [cybop-developers] Fwd: Re: [Xcb] Feature Request: Function "xcb_test_for_event"
Date: Wed, 10 Apr 2013 01:24:03 +0200
User-agent: KMail/1.13.7 (Linux/3.2.0-4-686-pae; KDE/4.8.4; i686; ; )

For archiving only ...

----------  Forwarded Message  ----------

Subject: Re: [Xcb] Feature Request: Function "xcb_test_for_event"
Date: Mittwoch 10 April 2013, 01:21:53
From: Christian Heller <address@hidden>
To: xcb <address@hidden>
CC: Julien Danjou <address@hidden>

Hi Bart,

> As Josh suggests, if you want to wait on multiple things at once, spawn a
> blocking thread per thing, and demux the result using the usual thread
> mechanisms. Pipes are probably overkill here: just use a locked queue. If
> you use a semaphore for locking the queue, you can block until something is
> in it conveniently.

there has been a lot of scientific debate about pros & cons of threads:

which I do not want to take part in. For the cyboi interpreter,
I have decided to let the main thread do everything and use threads
for detection of data on the various communication channels only.

Locking the queue is actually a good idea.

1 However, the cyboi queue is only allowed to store data in a format
called "part", in order to be able to process data in a uniform way.
Therefore, the queue cannot take terminal data, x window system mouse
click and other things in a mixed way.

2 The necessity to wrap each event as "part" would force the various
"detection" threads to allocate a "part" for each event arriving.
This would lead to conflicts with the main thread.
The reason is that there is only one global "knowledge tree" keeping
ALL parts, also those representing an event. While some "detection"
thread manipulates a part, the main thread might access it as well.
I therefore just set a flag (using mutex) informing the main thread.

(Side remark: The cybol language uses the same xml syntax for space+time,
i.e. for describing a gui or address or electronic health record = state
and for describing a function or workflow or algorithm = logic over time.
Each logic part may be put as event to the queue.)


Reform our monetary system! Money is a public infrastructure.
Use flowing money with demurrage, complementary, community currencies!

reply via email to

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