Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #6271
| From | yatremblay@bel1lin202.(none) (Yannick Tremblay) |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: pthread memory leaks |
| Date | 2011-06-06 09:38 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <isi770$ade$1@dont-email.me> (permalink) |
| References | <9430fe32-d385-49a3-b925-daf3cd421789@j13g2000pro.googlegroups.com> <078e7033-8005-41c3-a075-d77815d10cdd@e17g2000prj.googlegroups.com> <94iph6Fr2iU12@mid.individual.net> <b5371b7f-e6cb-4da7-92db-87944822be69@s16g2000prf.googlegroups.com> |
In article <b5371b7f-e6cb-4da7-92db-87944822be69@s16g2000prf.googlegroups.com>,
jakash3 <jakashthree@gmail.com> wrote:
>On May 30, 5:02 pm, Ian Collins <ian-n...@hotmail.com> wrote:
>> Have you looked at boost thread?
>>
>Yes, It doesn't appear to have thread suspension. I hope to implement
>this for my thread class:
Boost thread has designed decisions in its interface. I would say
that most of these design decisions are to encourage the users
to use multi-threading in a saner and safer manner than when starting
with the full low-level capabilities of pthread or Windows threads.
For example:
>class Thread {
>public:
>#ifdef _WIN32
> HANDLE tid;
>#else
> pthread_t tid;
>#endif
> void* (*sub)(void*);
> Thread();
> ~Thread();
> Thread(void* (*tfunc)(void*));
> Thread& operator= (void* (*tfunc)(void*));
> Thread& operator= (Thread t);
Please clarify what you intend here? Is this a normal assignment
operator? If so, what does it mean to "assign" an existing thread to
another?
You are defining an operator= without defining a copy-constructor
which is a typical no-no, unless you really can explain why.
If you define a copy-constructor, you also need to really understand
what it means.
Note: boost thread clearly define them as move operations, not copies.
And you would probably need to either pass by reference or need that
copy constructor.
> bool operator!= (void* (*tfunc)(void*));
> bool operator!= (Thread t);
> bool operator== (void* (*tfunc)(void*));
> bool operator== (Thread t);
> bool start(void* param = 0);
> void* term(void* (*quit)(void*) = 0, void* param = 0);
> bool stop();
> bool cont();
> bool join(void ** ret);
>};
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
pthread memory leaks jakash3 <jakashthree@gmail.com> - 2011-05-30 16:29 -0700
Re: pthread memory leaks Ian Collins <ian-news@hotmail.com> - 2011-05-31 11:50 +1200
Re: pthread memory leaks Ian Collins <ian-news@hotmail.com> - 2011-05-31 11:52 +1200
Re: pthread memory leaks Puppet_Sock <puppet_sock@hotmail.com> - 2011-05-31 06:46 -0700
Re: pthread memory leaks jakash3 <jakashthree@gmail.com> - 2011-05-30 17:00 -0700
Re: pthread memory leaks Ian Collins <ian-news@hotmail.com> - 2011-05-31 12:02 +1200
Re: pthread memory leaks jakash3 <jakashthree@gmail.com> - 2011-05-30 17:05 -0700
Re: pthread memory leaks yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-06-06 09:38 +0000
Re: pthread memory leaks Stuart Redmann <DerTopper@web.de> - 2011-05-31 00:16 -0700
Re: pthread memory leaks "Chris M. Thomasson" <cristom@charter.net> - 2011-06-10 15:46 -0700
Re: pthread memory leaks Adam Skutt <askutt@gmail.com> - 2011-05-31 03:20 -0700
Re: pthread memory leaks Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-01 08:27 +0000
Re: pthread memory leaks Miles Bader <miles@gnu.org> - 2011-06-01 17:39 +0900
Re: pthread memory leaks Ian Collins <ian-news@hotmail.com> - 2011-06-01 21:05 +1200
Re: pthread memory leaks Adam Skutt <askutt@gmail.com> - 2011-06-01 03:27 -0700
Re: pthread memory leaks Adam Skutt <askutt@gmail.com> - 2011-06-01 03:16 -0700
csiph-web