El 28/05/2015 a las 1:25, Gavin Lambert escribió:
On 28/05/2015 04:00, Ion Gaztañaga wrote:
El 26/05/2015 a las 8:08, Gavin Lambert escribió:
Given that the failure was somewhere related to directory names, what's probably happening is that it's trying to find the name of its shared directory. For that it evidently wants to use the boot time, as it's a value that should be identical for all processes started since the last reboot, but different between reboots (to avoid getting stale data).
Yes, that's the idea. Obtaining this "unique" identifier between reboots that remains stable between all processes it's been incredibly difficult. Any alternative or suggestion is welcome.
Use CreateFileMapping to create a named (simple constant name) mapping *not* backed by a file. Store whatever data you want in here; this can include a randomly-generated value used to look up other items if you wish (generated by the first process to create the mapping and then used by all subsequent processes -- you may need to use a mutex either within the mapping or via CreateMutex to resolve races if multiple processes simultaneously access the mapping for the first time).
If all processes close the mapping, that mapping disappears and Interprocess shared memory must have kernel lifetime (POSIX semantics). SEe http://www.boost.org/doc/libs/1_55_0/doc/html/interprocess/some_basic_explan... We need something that remains stable even if all processes using it are killed, launch a new one and connect to this resource. Only after the machine is rebooted the resource disappears. Ion