Jump to content

desert_coffee

Members
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Is there a way to get help insight(the on hover documentation) for standard library functions, instead of having to use the chm viewer? On delphi 10.3 currently.
  2. Thanks for the advice but mapping the field from boolean to byte/integer doesn't seem to work, it also returns zero in every case.
  3. For context this is using Mysql 8 and firedac. Due to some trouble I was having with tinyint(1) I switched the Tinyint format to be shortint and just did the conversion with a custom class. However it seems that when setting the TinyIntFormat to tifInteger it causes the field to always return false for fields that are bit(1). I've narrowed it down to the TDataSet.GetFieldData(Field: TField; var Buffer: TValueBuffer) setting the Buffer to (255,255) on true bit(1) fields when TinyIntFormat is tifBoolean, and setting it to (0,0) when TinyIntFormat is tifInteger, despite the fact that it does correctly use TBooleanField. Besides switching all my bit(1) columns to tinyint(1) is there a way to fix this?
  4. desert_coffee

    Attempt to release mutex not owned by caller

    The problem was that I was acquiring the mutex in a separate thread and deliberately freeing it within a main thread synchronize block. Also through some trial and error I realize that the TLockGuard only frees itself when assigned to an IInterface variable. Thanks for your help. I've added a check within a critical section that makes sure that _mtx is non-nil when acquiring and releasing.
  5. Hello, I'm trying to recreate the c++ lock_guard with this naive implementation TLockGuard = class(TInterfacedObject) private var _mtx: TMutex; _name: String; public constructor Create(mtx: TMutex; name: String = ''); destructor Destroy; override; end; constructor TLockGuard.Create(mtx: TMutex; name: String); begin inherited Create; _mtx := mtx; _name := name; if assigned(mtx) then begin loginfo(format('acquiring mutex %s', [_name]), 'thread'); _mtx.Acquire; loginfo(format('acquired mutex %s', [_name]), 'thread'); end else raise Exception.Create('mutex unassigned'); end; destructor TLockGuard.Destroy; begin if assigned(_mtx) then begin loginfo(format('releasing mutex %s', [_name]), 'thread'); try _mtx.Release; except on E: Exception do loginfo(E.toString, 'thread'); end; loginfo(format('released mutex %s', [_name]), 'thread'); end; inherited Destroy; end; but when Destroy is called and it tries to release the mutex I get this error: Is there a way to move ownership of the mutex?
×