Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Revamping Code Completion with little changes

<< < (5/10) > >>

Urxae:

--- Quote from: mandrav on August 22, 2005, 08:21:38 pm ---
--- Code: ---#define DELETE_WORKER_WHEN_DONE 0x01
[...]
        virtual bool AddThread(cbThreadPoolWorker* worker, bool deleteWhenDone = false);

--- End code ---

--- End quote ---
I just now saw that second line. What is the purpose of the #define if there is a parameter that seems to specify the exact same thing?

And you might want to rename AddThread and RemoveThread to something like AddJob and RemoveJob. From what I understand of thread pools you're not adding threads but jobs (or perhaps workers, but jobs sounds better ;)) which are then perfomred/executed by the pooled threads.

zieQ:
I would rename cbThreadPoolWorker to cbThreadedTask (or cbTask) since thread pool worker may be misunderstood as the thread that performs the task. For me, a thread live for long, whereas a task is short, but it is cosmetics. Moreover, I would hide the implementation details (PrivateThread, cbThreadPoolObject) in the cpp file and just keep forward declarations if necessary. And I don't like the #define CONSTANT...

zieQ:
Humm, a job is a list of tasks :p

mandrav:
You have to realize this is just a draft which I 'm working on. It's nowhere near completion and many things will change and/or move around.
I didn't post it so that Rick or anyone else could start working on revamping cc, but just for discussion...


--- Quote from: Urxae on August 22, 2005, 09:52:48 pm ---
--- Quote from: mandrav on August 22, 2005, 08:21:38 pm ---
--- Code: ---#define DELETE_WORKER_WHEN_DONE 0x01
[...]
 virtual bool AddThread(cbThreadPoolWorker* worker, bool deleteWhenDone = false);

--- End code ---

--- End quote ---
I just now saw that second line. What is the purpose of the #define if there is a parameter that seems to specify the exact same thing?

--- End quote ---

See? That's what I 'm talking about. Just to avoid the confusion, the AddThread()'s "delete" parameter tells cbThreadPool that this "thread" should be deleted on completion. The DELETE_WORKER_WHEN_DONE is set in cbThreadPoolObject.flags for this "thread" so that when it is done, it knows to delete it. In other words, these are two different steps of the process...
Instead of having " bool cbThreadPoolObject::deleteWhenDone;", we have a "int cbThreadPoolObject::flags;" as a bitmask...

Yiannis.

rickg22:
I'd suggest using ManagedThread instead of wxThread... after all i created those for a reason :)
Unless there are objections of course...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version