人生是一场不能存盘的RPG,我只能尽量多搞几个Screenshot

June 26, 2006

QueueUserWorkItem() 和UnsafeQueueUserWorkItem()

Filed under: .NET

Code Access Security(CAS) check.
CLR 会检查执行线程的call stack 中的所有assembly是否有权限访问受限制的资源.
否,则抛出SecurityException.

QueueUserWorkItem会把调用线程的权限赋给线程池中的线程,但是遍历调用线程的callstack
检查权限是一个耗时的操作,所以有了UnsafeQueueUserWorkItem().

调用UnsafeQueueUserWorkItem()的函数需要SecurityPermission,并把ControlPolicy和
ControlEvidenc打开.

Comments »

The URI to TrackBack this entry is: http://recordsome.blogsome.com/2006/06/26/p115/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.






















Get free blog up and running in minutes with Blogsome
Theme designed by Hadley Wickham