BUG: System.TMonitor 作为同步对象时可能会产生异常

shadowstar 2011-05-24 09:52:34
经过数日折磨之后终于确定是TMonitor存在BUG @_@,问题主要来自于Wait和Pulse这组函数。

因为Generics.Collections.TThreadedQueue同样使用了TMonitor来同步,所以TThreadedQueue也有BUG。

Classes.TThreadList也使用TMonitor,不过因为里面没有用到Wait函数,所以并TThreadList可以正常使用。
...全文
238 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
shadowstar 2011-05-25
  • 打赏
  • 举报
回复
只要在多线程环境下使用了Wait和Pulse函数都容易出错,目前没发现只使用Enter和Exit的情况下出错,不过还是尽量不要使用TMonitor,而用其它阻塞对象或WINAPI代替。
bdmh 2011-05-25
  • 打赏
  • 举报
回复
什么意思,你发现什么bug了,声明情况下会无效
介绍了最新版delphi 10.1 berlin的一些最新的技术比如跨平台开发,firemonkey等等,是近年来不可多得的一本delphi类的新书。 What this book covers Chapter 1, Delphi Basics, talks about a set of general approaches that should not be ignored by any Delphi programmer. Some topics are simple and immediate and some are not, but all of them should be well understood. By the end of this chapter, the reader is able to use some of the fundamental Delphi techniques related to RTL, VCL, and OS integration. Chapter 2, Becoming a Delphi Language Ninja, focuses on the Object Pascal language. The programming language is the way you talk to the machine, so you must be fluent and know all the possibilities offered. This chapter talks about higher-order functions, practical utilization of the extended RTTI, regular expressions, and other things useful to augment the power of your code and to lower the amount of time spent on debugging. Chapter 3, Knowing Your Friends – The Delphi RTL, focuses on the Delphi's RTL. There isn't a detailed description of all the Delphi's RTLs (you would need 10 books like this one, which would be particularly boring, I guess), but you can find some recipes that explain some of the most important RTL features and some less known but really useful classes. You'll learn how to use regular expressions, the most popular encoding format used by HTTP base applications, and how to use the built-in data de/compression-related classes. Chapter 4, Going Cross-Platform with FireMonkey, is dedicated to the FireMonkey framework in general. What you will learn from this chapter can be used in many of the platforms that FireMonkey supports. Moreover, you will learn about non-trivial LiveBindings utilizations. Chapter 5, The Thousand Faces of Multithreading, talks about thread synchronization and the mechanisms used to obtain this synchronization, such as TMonitor, thread-safe queues, and TEvent. It is also one of the most complex chapters. By the end of this chapter, the reader will be able to create and communicate with background threads, leaving your main thread free to update your GUI (or to communicate with the OS). Chapter 6, Putting Delphi on the Server, focuses on how well Delphi can behave when running on a server. Some people think that Delphi is a client-only tool, but that's not true. In this chapter, we'll show you how to create powerful servers that offer services over a network. We'll also implement a JavaScript client that brings the database data into the user browser. The techniques explained in this chapter open a range of possibilities, especially in the mobile and web area. Chapter 7, Linux Development, is dedicated to development with Delphi on the most commonly-used operating system for server environments— Linux. This chapter covers several key points about Linux development: from the foundation, such as handling signals, forking, and daemonizing processes to the construction of RESTFul Server with database access and JavaScript client. Chapter 8, Riding the Mobile Revolution with FireMonkey, explores the mobile development with Delphi and FireMonkey. If you are interested in mobile development, I think that will be your favorite chapter! Mobile is everywhere, and this chapter will explain how to write software for your Android or iOS device, what are the best practices to use, how to save your data on the mobile, how to retrieve and update remote data, and how to integrate with the mobile operating system. Chapter 9, Using Specific Platform Features, shows you how to integrate your app with the underlying mobile operating systems beyond what FireMonkey offers. You will learn how to import Java and Objective C libraries in your app and how to use the SDK classes from your Object Pascal code. Chapter 10, Delphi and IoT, talks about how the two most popular boards on the market—Arduino and Raspberry Pi—can interact with Delphi. You will learn how a Delphi application can control them, how can you control the components associated with them and recover data that they hold. The approach and techniques explained in this chapter open Delphi to IoT.

16,749

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧