Jean-Louis Villecroze wrote:
Wojtek Lerch <> firstname.lastname@example.org> > wrote:
Jean-Louis Villecroze <> email@example.com> > wrote:
int flag = PtEnter(Pt_EVENT_PROCESS_ALLOW);
Have you tried using zero instead of Pt_EVENT_PROCESS_ALLOW?
I tried PtEnter(0) and that didn’t change a things. I also
tried using a PtMainLoop instead of my own loop , and this
gave me the exact same result.
There is a problem with how PtFileSelection() uses
PtBkgdHandlerProcess() that caused it to read the directory horribly
slowly in a multithreaded environment. I would expect that the version
that uses PtMainLoop() will return to a sane state eventually, but you
might need to wait a minute or two…
My first reaction was that Pt_EVENT_PROCESS_ALLOW could be making things
worse, but after giving it more thought I think it does not matter at
all. But in general, I think it’s a good habit to use zero unless you
have a reason not to.
BTW: If PtEnter() has failed, it’s unsafe to call PtFileSelection()
unless you check that the reason it failed is because you already had
the lock. Something like
flag = PtEnter( 0 );
if ( flag >= 0 || flag == -EDEADLK )
PtFileSelection( … );
if ( flag >= 0 )
PtLeave( flag );
In general I think it’s a good habit to design your code to minimize the
number of functions that don’t know whether the library is locked and
have to rely on the EDEADLK behaviour of PtEnter(). This way, most of
your code can safely assume that PtEnter() returning an error is a bad
The PtFileSelection window is display but the list of file stay empty, and
the cursor stay in hourglass style for a while and then the content of
the directory is display , and an error message is display in the
PhEventNext failed: Resource busy
I don’t think the Photon library prints out a message like that. Are
you calling PhEventNext() from your code?
Yes, I’m not using PtMainLoop, maybe I forgot to do something
important in my mainloop ?
Well, “forgot” is not exactly the best word. It’s practically
impossible to write your own main loop if you want to use input procs,
workprocs, or PtEnter() and PtLeave(). All these mechanisms (and
probably a few more that I can’t think of at the moment) rely on a
private data structure that is not defined in any of the headers that
you have access to.
Wojtek Lerch (firstname.lastname@example.org) QNX Software Systems Ltd.