Photon application with multithreading

How a thread can change ressources of a widget ?

There is a equivalent of XtAppAddWorkProc() (XWindow) ?

Photon is NOT thread safe!

“bruno” <bruno.suarez@scola.ac-paris.fr> wrote in message
news:3A33C418.6EFDC7B1@scola.ac-paris.fr

How a thread can change ressources of a widget ?

There is a equivalent of XtAppAddWorkProc() (XWindow) ?

Mario Charest <mcharest@void_zinformatic.com> wrote:

Photon is NOT thread safe!

In article <911cbf$gfv$1@nntp.qnx.com> you wrote:

Photon is NOT thread safe!

The problem is not caused only by thread unsafeness of Photon.
I have used several thread UNsafe libraries (on Linux, but it does not
matter) in multithreaded programs. When some function/library is not thread
safe, you could avoid problems by synchronising function calls/access to
resources using e.g. mutexes (or whatever you want).

Photon are a harder case, since the code (and corresponding function calls)
is generated by PhAb and so the approach mentioned aboved is quite hard
to be implemented. If your Photon thread has during its run periods, when
it does not use Photon (some computation), it could allow the other threads
to access Photon resources. Good luck.

“bruno” <> bruno.suarez@scola.ac-paris.fr> > wrote in message
news:> 3A33C418.6EFDC7B1@scola.ac-paris.fr> …
How a thread can change ressources of a widget ?

There is a equivalent of XtAppAddWorkProc() (XWindow) ?

Mgr. Martin Gazak, MicroStep-MIS
Ilkovicova 3, 841 04 Bratislava, Slovakia
e-mail:matog@microstep-mis.sk

Mario Charest <mcharest@void_zinformatic.com> wrote:

Photon is NOT thread safe!

Not the way printf() or malloc() is, but using threads in a Photon app
is not generally forbidden any more. Check out PtEnter() and PtLeave()
in the docs.


Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.

In article <9123r9$psi$1@charon.mstep-hdo.sk>,
Martin Gazak <matog@nod10.mstep> wrote:

Mario Charest <mcharest@void_zinformatic.com> wrote:

Photon is NOT thread safe!

In article <911cbf$gfv$> 1@nntp.qnx.com> > you wrote:

Photon is NOT thread safe!

The problem is not caused only by thread unsafeness of Photon.
I have used several thread UNsafe libraries (on Linux, but it does not
matter) in multithreaded programs. When some function/library is not thread
safe, you could avoid problems by synchronising function calls/access to
resources using e.g. mutexes (or whatever you want).

Photon are a harder case, since the code (and corresponding function calls)
is generated by PhAb and so the approach mentioned aboved is quite hard
to be implemented. If your Photon thread has during its run periods, when
it does not use Photon (some computation), it could allow the other threads
to access Photon resources. Good luck.

However, all of the callbacks are invoked from the Photon main loop, when
it calls PtProcessEvent or PtAppProcessEvent, so if you control
which threads are reading and processing Photon events,
you have all of the protection you need. i.e. you don’t need to provide
any protection on callbacks, work procs, etc.

Indeed, you can protect this with mutexes, reader-writer locks or
monitor locks (mutex & condvar). Using the newer Photon locking
primitives provides better control over multiple readers trying
to receive Photon events, though.

“bruno” <> bruno.suarez@scola.ac-paris.fr> > wrote in message
news:> 3A33C418.6EFDC7B1@scola.ac-paris.fr> …
How a thread can change ressources of a widget ?

There is a equivalent of XtAppAddWorkProc() (XWindow) ?

Mgr. Martin Gazak, MicroStep-MIS
Ilkovicova 3, 841 04 Bratislava, Slovakia
e-mail:> matog@microstep-mis.sk >

Steve Furr email: furr@qnx.com
QNX Software Systems, Ltd.