Coder Social home page Coder Social logo

alter-cash / code-delphi-thread-safety Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dalijap/code-delphi-thread-safety

0.0 0.0 0.0 69 KB

Code examples from Delphi Thread Safety Patterns Book

Home Page: https://dalija.prasnikar.info/

License: Other

Pascal 100.00%

code-delphi-thread-safety's Introduction

Code examples from Delphi Thread Safety Patterns Book

https://dalija.prasnikar.info/delphitspatt/

https://dalija.prasnikar.info

Part 2. The Core Run-Time Library

Chapter 5. Floating-point control register

  • BrokenMath.dpr
  • BrokenMath.dproj
  • SafeMath.dpr
  • SafeMath.dproj

Chapter 7.1. Parameters

  • Parameters.dpr
  • Parameters.dproj
  • ParametersMainF.pas
  • ParametersMainF.dfm

Chapter 8. Class fields, singletons, and default instances

  • Singletons.dpr
  • Singletons.dproj
  • SingletonsMainF.pas
  • SingletonsMainF.dfm
  • SingletonClasses.pas
  • SingletonLocal.pas
  • SingletonClassProp.pas
  • SingletonLazy.pas

Chapter 12. Collections

  • CollectionsTest.dpr
  • CollectionsTest.dproj
  • CollectionsMainF.pas
  • CollectionsMainF.dfm

Chapter 13. Parallel collection processing

  • 13.1 Independent processing of individual collection items

    • ParallelCollections.dpr
    • ParallelCollections.dproj
    • ParallelCollectionsMainF.pas
    • ParallelCollectionsMainF.dfm
  • 13.2 Dependent processing of individual collection items

    • DependentParallelCollections.dpr
    • DependentParallelCollections.dproj
    • DependentParallelCollectionsMainF.pas
    • DependentParallelCollectionsMainF.dfm

Part 3. Core Frameworks

Chapter 16. Serialization

  • Serialization.dpr
  • Serialization.dproj
  • SerializationMainF.pas
  • SerializationMainF.dfm

Chapter 17. System.Net

  • NetClient.dpr
  • NetClient.dproj
  • NetClientMainF.pas
  • NetClientMainF.dfm

Chapter 19. Indy

  • Indy.dpr
  • Indy.dproj
  • IndyMainF.pas
  • IndyMainF.dfm

Chapter 20. REST

  • RESTDemo.dpr
  • RESTDemo.dproj
  • RESTMainF.pas
  • RESTMainF.dfm

Chapter 21. Regular expressions

  • RegEx.dpr

Part 5. Graphics and Image Processing

Chapter 27. Resource consumption

  • Resources.dpr
  • Resources.dproj
  • ResourcesMainF.pas
  • ResourcesMainF.dfm

Chapter 30. VCL graphics example

  • Images.dpr
  • Images.dproj
  • ImagesMainF.pas
  • ImagesMainF.dfm

Part 6. Custom Frameworks

Chapter 33. Logging

  • NX.Log.pas
  • Logging.dpr
  • Logging.dproj

Chapter 34. Cancellation tokens

  • NX.Tokens.pas
  • Tokens.dpr
  • Tokens.dproj
  • TokensMainF.pas
  • TokensMainF.dfm

Chapter 35. Event bus

  • NX.Horizon.pas
  • Horizon.dpr
  • Horizon.dproj
  • HorizonMainF.pas
  • HorizonMainF.dfm

Chapter 36. Measuring performance

  • NX.Chronos.pas
  • ZeroThread.dpr
  • ZeroThread.dproj

Note: Purpose of the presented examples is to either show thread-unsafe code and issues that may arise in such code, or to show general coding patterns for achieving thread-safe code while multiple threads are running. As such many of them don't implement proper cleanup on application shutdown, and if you close the application before started background tasks or threads completed their job, application may crash.

In order to perform clean shutdown, you either need to wait for task or thread completion or use some other mechanism that will prevent accessing GUI or other shared data during application shutdown.

You can find examples on how to shutdown application in https://github.com/dalijap/code-delphi-async Chapter 35.2 Cleanup on GUI destruction

code-delphi-thread-safety's People

Contributors

dalijap avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.