Commit Graph

68 Commits

Author SHA1 Message Date
Michaël Van Canneyt
972b5181eb * Delta stream support 2023-11-08 11:27:21 +01:00
Michaël Van Canneyt
594090b215 * Add delphi-compatible observers to classes 2023-11-08 00:04:18 +01:00
Michaël Van Canneyt
e4ebf46df3 * Some delphi compatibility types and consts 2023-11-01 23:19:56 +01:00
Michael VAN CANNEYT
ccfa38c68e * Dotted RTL compiles 2023-07-27 19:04:03 +02:00
Michael VAN CANNEYT
68db04d89e * Adapt classes to Unicode RTL : Give string/char correct type depending on case 2023-07-24 15:37:51 +02:00
Michael VAN CANNEYT
98cdab5200 * Add MainUnit 2023-07-14 17:26:10 +02:00
Michael VAN CANNEYT
d23fa5a87f * Char -> AnsiChar 2023-07-14 17:26:10 +02:00
Sven/Sarah Barth
e774a6275c * change Result of CheckSynchronize to true when at least one method was executed (matches with both FPC and Delphi documentation) 2023-03-17 15:53:25 +01:00
Sven/Sarah Barth
b2b2606e36 + add function reference suitable overload of TThread.ForceQueue() 2023-03-11 17:08:32 +01:00
Michaël Van Canneyt
0e2102e172 * Resource handle is not resource ID 2023-03-08 16:12:59 +01:00
Michaël Van Canneyt
c3c3bd3471 * Fix windows compilation 2023-03-08 10:09:58 +01:00
Michaël Van Canneyt
f9a96e5e63 * Avoid useless exceptions by checking existence of resource 2023-03-07 11:43:39 +01:00
mattias
ea4768456f rtl: ObjectBinaryToText, ObjectTextToBinary: support unitname/classname 2023-01-08 20:30:52 +01:00
marcoonthegit
e5ac0b2689 * anonymous method overloads for synchronize/queue. 2022-06-01 13:54:06 +02:00
Michaël Van Canneyt
52c8ac0ca0 * Fix by Mark Paley to add IfThen for StringList and TStringDynArray. Issue #39314 2021-09-01 09:29:50 +02:00
ondrej
706d89d6cc * GlobalNameSpace must EndWrite before it is released to unlock the critical section
git-svn-id: trunk@47636 -
2020-11-29 18:49:36 +00:00
ondrej
192bbc07f5 * simplify TThread.RemoveQueuedEvent - decide what to delete and not what to leave (better corresponds with the docs)
git-svn-id: trunk@47011 -
2020-09-30 06:56:27 +00:00
svenbarth
a624348692 * when removing a method from the synchronization queue using TThread.RemoveQueuedEvent then both the Code and the Data need to match (Delphi does the same)
+ added test

git-svn-id: trunk@47007 -
2020-09-29 17:34:26 +00:00
svenbarth
11b601d44c * TThread.Terminate does not have any platform specific behavior (it should only set FTerminated to true and call TerminatedSet), thus move it to the platform independant part
Notes:
- Netware had a ThreadSwitch in there, but that is not really required
- some platform were missing the setting of FTerminated to True, thus they'll now do that as well

git-svn-id: trunk@46543 -
2020-08-22 15:56:13 +00:00
michael
b7bd9f3325 * Add TerminatedSet (delphi compatibility, bug ID #37388)
git-svn-id: trunk@45805 -
2020-07-18 22:35:36 +00:00
svenbarth
c8b7094378 * fix for Mantis #36940: apply (adjusted) patch by Bi0T1N to add functionality to the thread manager to set a thread's debug name (if supported by the platform)
git-svn-id: trunk@45160 -
2020-04-28 19:58:20 +00:00
michael
e3973e9c4e * Fix bug #35305, lazy instantiation of class alias list. Patch from Ondrej Pokorny
git-svn-id: trunk@41819 -
2019-04-01 17:31:20 +00:00
svenbarth
b810d8f32b * fix for Mantis #35027: ensure that the synchronize event entry is reset correctly in case of an exception
+ added test

git-svn-id: trunk@41281 -
2019-02-10 15:43:03 +00:00
svenbarth
1502a13e7c * fix for Mantis #35028: when the mainthread executes a queued ThreadMethod make sure that the queue entry is released even if an exception is raised
+ added test

git-svn-id: trunk@41280 -
2019-02-10 15:42:58 +00:00
svenbarth
81fa0924d8 * an exception does not need to inherit from Exception, so declare that as such for the thread queue entry for the sake of clarity
git-svn-id: trunk@40652 -
2018-12-25 23:30:38 +00:00
svenbarth
3e0da1ef1c * fix for Mantis #34640: don't access the thread queue entry directly after it was added to the queue if it's a Queue()d entry instead of a Synchronize()d one
git-svn-id: trunk@40651 -
2018-12-25 23:30:35 +00:00
pierre
921b406c05 Fix for webtbs/tw11006.pp and test/tbs/tb0632.pp instability.
* Add ThreadQueueLockCounter variable to
  postpone call to DoneCriticlSection to the last thread
  that decrements back the counter to zero.
  * CommonCleanup:
  Protect ThreadQueue emptying within
  a Enter/Leave-CriticalSection to avoid access y other
  threads at the same time.

git-svn-id: trunk@38626 -
2018-03-25 20:32:25 +00:00
svenbarth
640480272f * adjust TThread.Synchronize so that it also works correctly if the passed in thread instance is not the instance of the current thread
+ added test

git-svn-id: trunk@38124 -
2018-02-05 21:50:00 +00:00
svenbarth
2d52536460 * only check for the method if one is given at all (otherwise everything would be skipped)
git-svn-id: trunk@38115 -
2018-02-04 20:20:32 +00:00
svenbarth
81a0f88d8c + add Delphi compatible TThread.ForceQueue() which enqueues the method also for the main thread (at least if the RTL is in multi threading mode, otherwise it's still executed right away - whether this is Delphi compatible needs to be tested as I only have a 10.1 currently which does not yet support TThread.ForceQueue())
+ added test

git-svn-id: trunk@37359 -
2017-09-29 21:19:45 +00:00
pierre
78343902bf Allow objpas classes and sysutils units to compile with threading support disabled
git-svn-id: trunk@36107 -
2017-05-04 22:13:11 +00:00
svenbarth
ed144a6535 * fix for Mantis #30567; the method only needs to be left with nothing to do if both method and thread are Nil
git-svn-id: trunk@34456 -
2016-09-08 17:22:45 +00:00
svenbarth
dc5d9c7001 rtl/objpas/classes/classes.inc, TThread:
* Synchronize: fill the syncentry using the correct size

git-svn-id: trunk@33879 -
2016-06-02 18:48:41 +00:00
svenbarth
d5cc59c22e Avoid the creation of a TExternalThread instance for Synchronize() and Queue() (Delphi does the same).
Note: the Sender parameter of WakeMainThread will be Nil for such threads. This is Delphi compatible.

rtl/objpas/classes/classesh.inc, TThread:
  + TThreadQueueEntry: new field ThreadID so that entries with Thread = Nil can be removed
rtl/objpas/classes/classes.inc, TThread:
  * InitSynchronizeEvent: setup ThreadID field
  * Synchronize: use a local TThreadQueueEntry if no TThread instance was passed in
  * Queue: setup ThreadID
  * RemoveQueueEvents: also check for ThreadID when trying to find the current thread

git-svn-id: trunk@33863 -
2016-05-31 20:01:52 +00:00
michael
789b80f702 * ExecuteInThread added
git-svn-id: trunk@33100 -
2016-02-16 18:59:35 +00:00
michael
9157a11b7e * Applied partial patch from barlone to change var->out for IdentToInt
git-svn-id: trunk@32825 -
2016-01-01 17:37:46 +00:00
yury
7c62aadf65 * Fixed string conversion warnings in RTL.
git-svn-id: trunk@31752 -
2015-09-17 17:25:57 +00:00
svenbarth
b0fa341006 Fix for Mantis #28271.
rtl/objpas/classes/classes.inc:
  + new variable ExternalThreadsCleanup to keep track whether ExternalThreads list is currently cleared
  * TExternalThread.Create: add the thread instance to the external thread list
  * TExetrnalThread.Destroy: remove the thread instance from the external thread list (if not in system cleanup anyway)
  * CommonCleanup: set ExternalThreadsCleanup to true so that the threads don't remove themselves from the list anymore

+ added test

git-svn-id: trunk@31028 -
2015-06-12 13:39:31 +00:00
Károly Balogh
cdea58317e classes: since AThreads supports suspended thread creation, enable resume code in AfterConstruction for Amiga-like platforms too
git-svn-id: trunk@30941 -
2015-05-31 09:37:43 +00:00
michael
af9798c761 * MOve update of threadqueuetail to critical section
git-svn-id: trunk@30159 -
2015-03-10 08:12:39 +00:00
michael
0b52513c18 * Fix for bug ID #27628
git-svn-id: trunk@30153 -
2015-03-09 19:38:26 +00:00
Tomas Hajny
590e2f7977 * fix for bug #16884 for OS/2
git-svn-id: trunk@29712 -
2015-02-15 19:39:53 +00:00
Károly Balogh
e89669bedc rewrite SpinLock to still work without the need to accidentally disable optimizations for a large part of the classes unit
git-svn-id: trunk@27864 -
2014-06-06 11:05:57 +00:00
pierre
d4368c55b9 Fix windows problem with FindResource function
git-svn-id: trunk@27782 -
2014-05-14 06:11:53 +00:00
michael
ddf6de1b29 * Implemented ReadComponentRes(ex) for bug #21785
git-svn-id: trunk@27777 -
2014-05-11 18:28:50 +00:00
nickysn
015c7e951a * Changed the default packset setting to 1 and disabled the padding of 3-byte
sets to 4 bytes on 16 and 8-bit CPUs. This is compatible with Turbo Pascal 7
  and Delphi 1.

git-svn-id: trunk@27140 -
2014-03-14 23:51:14 +00:00
michael
b5a2b3860b * Added AddEmptyStrings to ExtractStrings (bug 25633)
git-svn-id: trunk@26600 -
2014-01-28 08:38:29 +00:00
nickysn
e342c11085 + introduced a private type TCodePtrList, which is the specialization
TFPGList<CodePointer> on archs/memory models where CodePointer is different
  than Pointer. On archs/memory models where CodePointer = Pointer, TCodePtrList
  is simply an alias of TList and the fgl unit isn't pulled in.
* the type of FindGlobalComponentList changed to TCodePtrList and the typecasts
  from TFindGlobalComponent (procvar type) to Pointer changed to CodePointer.
  This fixes compilation of unit classes in the i8086 medium memory model.

git-svn-id: trunk@25357 -
2013-08-23 19:25:51 +00:00
svenbarth
bd7cc36ea6 The documentation says that a "BeginThread" needs to be followed by a "CloseThread". The implementation of TThread did not respect this yet.
Note: The only RTL where this could lead to problems is for BeOS with the old threading implementation as this does not use "BeginThread" at all (the newer implementation does).

rtl/objpas/classes/classes.inc, TThread.Destroy:
  * call "CloseThread" if the thread handle is valid (mimics the logic of the Windows RTL)
rtl/win/tthread.inc, TThread.SysDestroy:
  * remove the call to "CloseHandle"; this is done by "CloseThread" afterwards

git-svn-id: trunk@24313 -
2013-04-23 20:13:07 +00:00
svenbarth
da7b24e242 Avoid multiple threadvar lookups when querying the current TThread. Inspired by Michael Schnell.
rtl/objpas/classes/classes.inc, TThread.GetCurrentThread:
	* instead of checking CurrentThreadVar and reading it again afterwards we read it first into Result and check this value; this way we have one read access in the normal case and one read and one write access in the worst case

git-svn-id: trunk@23706 -
2013-03-07 20:15:32 +00:00