comp.os.mswindows.programmer.win32
  Home FAQ Contact Sign in
Your Ad Here
comp.os.mswindows.programmer.win32 only
 
Advanced search
May 2008
motuwethfrsasuw
   1234 18
567891011 19
12131415161718 20
19202122232425 21
262728293031  22
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007    
total
comp.os ... win32 Profile…
RELATED GROUPS

POPULAR GROUPS

more...


 Up
  I need some info on how to do trial version sofware         


Author: John Smith
Date: May 10, 2008 12:13

I want to do a one-month-free-trial-version of my software (windows 32 bit). What
would be the best way to do it? The sofware is expected to connect to internet so
maybe it could fetch a key from dedicated server.

I am looking for pointer & ideas.
15 Comments
Your Ad Here
  Threads, memory allocation, and dangling pointers         


Author: r_z_aret
Date: May 10, 2008 11:20

I know this is really a C++, not Win32 question, but I don't hang
around any C++ group, so please tolerate.

If an object is instantiated in the main thread of a program, but
allocates memory when referenced in a worker thread, should that
memory be accessible by the main thread once the worker thread ends?

Example:
I have a class (PFBitMap) that handles BMP and JPEG files. PFBitMap
uses objects in a class (PFString) that handles strings (for filename,
date stamp, etc.). When a PFBitMap object is instantiated, it
instantiates all its PFString objects.

PFString objects allocate memory dynamically (using new).

My program instantiates a few PFBitMap objects. I want to use a worker
thread when one of these objects reads a file. But I ran into problems
when the main thread tried to access the PFString objects (e.g. a date
stamp). No problems if I read files in the main thread or if I make
pre-allocate all the PFStrings.

Pre-allocating the strings seems like a good solution, but I would
like feedback.
Show full article (1.38Kb)
4 Comments