how to release hashtable object ? #5

Closed
opened 2017-11-27 00:45:50 +00:00 by leeonsoft · 2 comments
leeonsoft commented 2017-11-27 00:45:50 +00:00 (Migrated from github.com)

Obj := TTestObject.Create;
Obj.Name := 'James';
ObjectHashTable := TPasMPHashTable<string, TObject>.Create();
try
ObjectHashTable.SetKeyValue('James', Obj);
if ObjectHashTable.GetKeyValue('James', objout) then
begin
Writeln('Found Object...');
end
else
Writeln('not Found Object...');
finally
ObjectHashTable.Free;
end;
Writeln(Obj.Name);

how to Iterative HashTable Object ?

Obj := TTestObject.Create; Obj.Name := 'James'; ObjectHashTable := TPasMPHashTable<string, TObject>.Create(); try ObjectHashTable.SetKeyValue('James', Obj); if ObjectHashTable.GetKeyValue('James', objout) then begin Writeln('Found Object...'); end else Writeln('not Found Object...'); finally ObjectHashTable.Free; end; Writeln(Obj.Name); how to Iterative HashTable Object ?
BeRo1985 commented 2017-11-27 01:53:55 +00:00 (Migrated from github.com)

To do this, you have to add a list of these objects yourself, because otherwise it would break the thread-safe principle of this PasMP hash-table construct, or at least it would make the implementation of it more complex, and thus possibly also slower, because more sync zones would be needed then, for to be able to provide such functionality in a thread-safe hash-table at all. Because one thing you don't want, locks or more locks.

To do this, you have to add a list of these objects yourself, because otherwise it would break the thread-safe principle of this PasMP hash-table construct, or at least it would make the implementation of it more complex, and thus possibly also slower, because more sync zones would be needed then, for to be able to provide such functionality in a thread-safe hash-table at all. Because one thing you don't want, locks or more locks.
leeonsoft commented 2017-11-27 10:27:45 +00:00 (Migrated from github.com)

Okay, I understand. Thank you

Okay, I understand. Thank you
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
BeRo1985/pasmp#5
No description provided.