| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 2 | |
Hi all
is it possible to create and run a QThread from within a QThread ?
I'm thinking at an InitThread that starts, load the application
configuration and then, accordingly to the cfg, starts some other
threads for the hw I/O process, for network comunication and so on.
I've never tryed yet, but is it ok to create a QThread in a QThread
constructor ? and in it's run() function ?
cheers
Andy
--
[ signature omitted ]
On Mon, Jan 14, 2008 at 12:20:24PM +0100, Andy Hirsh wrote: > Hi all > > is it possible to create and run a QThread from within a QThread ? > > I'm thinking at an InitThread that starts, load the application > configuration and then, accordingly to the cfg, starts some other > threads for the hw I/O process, for network comunication and so on. > > I've never tryed yet, but is it ok to create a QThread in a QThread > constructor ? and in it's run() function ? > Never tried this, but I think, that it should work. However don't forget that QThread inherits QObject, so after deleting QThread object, all child thread objects (created like new QThread(this)) will be deleted too. -- [ signature omitted ]
Attachment:
signature.asc
Description: Digital signature
Dmitry Nezhevenko wrote: > On Mon, Jan 14, 2008 at 12:20:24PM +0100, Andy Hirsh wrote: >> Hi all >> >> is it possible to create and run a QThread from within a QThread ? >> >> I'm thinking at an InitThread that starts, load the application >> configuration and then, accordingly to the cfg, starts some other >> threads for the hw I/O process, for network comunication and so on. >> >> I've never tryed yet, but is it ok to create a QThread in a QThread >> constructor ? and in it's run() function ? >> > > Never tried this, but I think, that it should work. However don't forget > that QThread inherits QObject, so after deleting QThread object, all child > thread objects (created like new QThread(this)) will be deleted too. It's certainly possible to create a QThread in the run() method of an extant QThread. I've never tried doing so from the ctor of a QThread, though I suspect that there's nothing to prevent that either. -- [ signature omitted ]