首页 \ 问答 \ 为什么和pthread_t是不透明类型?(Why and in what sense is pthread_t an opaque type?)

为什么和pthread_t是不透明类型?(Why and in what sense is pthread_t an opaque type?)

这里的帖子表明, pthread_t是一个不透明的类型,不是一个数字,当然不是一个线索索引,你不应该直接比较pthread_t等。

问题:

  1. 为什么? 是否真的有意支持线程没有数字标识的系统? 当pthread_t实现简单时

    typedef unsigned long int pthread_t;
    

  2. 怎么样? 在上面的一行之前有一条评论,所以它实际上是

    /* Thread identifiers. The structure of the attribute type is not
       exposed on purpose.  */
    typedef unsigned long int pthread_t;
    

    pthreadtypes.h是什么意思? 什么属性类型? 这不是一个全局线程表的索引吗?


Posts here on SO suggest that pthread_t is an opaque type, not a number, certainly not a thread index, that you shouldn't directly compare pthread_t's, etc. etc.

Questions:

  1. Why? Is there really the intent to support systems with no numeric IDs for threads? When the pthread_t implementation is simply

    typedef unsigned long int pthread_t;
    

    ?

  2. How? There's a comment before the above line, so it's actually

    /* Thread identifiers. The structure of the attribute type is not
       exposed on purpose.  */
    typedef unsigned long int pthread_t;
    

    in pthreadtypes.h what does that mean? What attribute type? Isn't this an index into some global table of threads?


原文:https://stackoverflow.com/questions/33285562
更新时间:2022-03-13 09:03

最满意答案

转到“报告属性”>“代码”并添加以下自定义代码:

Public Function hsl2htmlColor(ByVal h as Double, ByVal s as Double, ByVal l as Double) as string
    dim r as Double
    dim g as Double
    dim b as Double

    If s = 0 Then
        r = g = b = l
    Else
        dim q as Double

        If l < 0.5 Then 
            q = l * (1 + s) 
        Else
            q = l + s - l * s 
        End If

        dim p as Double = 2 * l - q
        r = hue2rgb(p, q, h + 1/3)
        g = hue2rgb(p, q, h)
        b = hue2rgb(p, q, h - 1/3)
    End If

    return "#" & right("00" & Hex(r * 255) , 2) & right("00" & Hex(g * 255) , 2) & right("00" & Hex(b * 255) , 2)
End Function

Public Function hue2rgb(ByVal p as Double, ByVal q as Double, ByVal t as Double) as Double
    If t < 0    Then t += 1
    If t > 1    Then t -= 1
    If t < 1/6  Then return p + (q - p) * 6 * t
    If t < 1/2  Then return q
    If t < 2/3  Then return p + (q - p) * (2/3 - t) * 6
    return p
End Function

(示例)转到文本框属性并将以下表达式添加到“字体”>“颜色”。 每个参数的比例从0到1。

=Code.hsl2htmlColor(0.268 , 0.389 , 0.476)

Go to "Report Properties" > Code and add following custom code:

Public Function hsl2htmlColor(ByVal h as Double, ByVal s as Double, ByVal l as Double) as string
    dim r as Double
    dim g as Double
    dim b as Double

    If s = 0 Then
        r = g = b = l
    Else
        dim q as Double

        If l < 0.5 Then 
            q = l * (1 + s) 
        Else
            q = l + s - l * s 
        End If

        dim p as Double = 2 * l - q
        r = hue2rgb(p, q, h + 1/3)
        g = hue2rgb(p, q, h)
        b = hue2rgb(p, q, h - 1/3)
    End If

    return "#" & right("00" & Hex(r * 255) , 2) & right("00" & Hex(g * 255) , 2) & right("00" & Hex(b * 255) , 2)
End Function

Public Function hue2rgb(ByVal p as Double, ByVal q as Double, ByVal t as Double) as Double
    If t < 0    Then t += 1
    If t > 1    Then t -= 1
    If t < 1/6  Then return p + (q - p) * 6 * t
    If t < 1/2  Then return q
    If t < 2/3  Then return p + (q - p) * (2/3 - t) * 6
    return p
End Function

(example) Go to your text box properties and add following expression to Font > Color. The scale for each argument is from 0 to 1.

=Code.hsl2htmlColor(0.268 , 0.389 , 0.476)

相关问答

更多
  • nm是正确的 - “HSL可以代表每种RGB颜色,但HSL舍入到最接近的整数不能。” 我最后用我正在编写的颜色类做的是在内部将颜色存储为未连接的HSL。 然后,RGB和HSL的getter方法在调用时将它们舍入。 这样就可以改变色调和饱和度,甚至可以改变RGB颜色,而不会产生不准确的转换。 仍然无法准确转换圆形RGB和圆形HSL,因此解决方案是简单地永远不会将圆形RGB转换为圆形HSL。 n.m. is correct—"HSL can represent every RGB color, but HSL ...
  • Garry Tan在他的博客上发布了一个Javascript解决方案(他归因于一个现在已经失效的mjijackson.com, 但存档在这里 , 原作者有一个要点 - 感谢user2441511)。 代码重新发布如下: HSL到RGB: /** * Converts an HSL color value to RGB. Conversion formula * adapted from http://en.wikipedia.org/wiki/HSL_color_space. * Assumes h, ...
  • 颜色插值在SVG规范中定义。 基本上,距离是RGB颜色空间中颜色之间的标准矢量距离。 即使您现在可以在大多数UA中指定HSL中的结束状态,您也不会获得HSL插值。 您的HSL端点颜色将转换为RGB,然后插值将在RGB颜色空间中进行。 interpolation of colours is defined in the SVG specification. Basically distance is the standard vector distance between the colours in the ...
  • 这可能是我处理它的方式 /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g This is probably how I'd handle it /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g
  • 你可以尝试使用这样的东西? yourColor = 0xFF0000; System.Drawing.Color myColor = System.Drawing.Color.FromArgb(yourColor); You could try using something like this? yourColor = 0xFF0000; System.Drawing.Color myColor = System.Drawing.Color.FromArgb(yourColor);
  • 我假设,无论你最终使用的是什么样的地图,你都希望将黑色映射为黑色,将白色映射为白色并将灰色映射为灰色。 添加剂映射 H'= H +(H 靶 - H 碱 ) (使用环绕)你用于色调确实可能没问题。 对于饱和度,保留灰度值的需要表明乘法映射 S'= S *(S target / S base ), 值超过100%的饱和度被削减。 但是,对于亮度,线性贴图不会这样做,因为您想要在调整中间值时同时修复0%和100%亮度。 一个自然的选择可能是伽马型地图,即 L'= pow(L,log(L target )/ log ...
  • 转到“报告属性”>“代码”并添加以下自定义代码: Public Function hsl2htmlColor(ByVal h as Double, ByVal s as Double, ByVal l as Double) as string dim r as Double dim g as Double dim b as Double If s = 0 Then r = g = b = l Else dim q as Double ...
  • 经过一夜的调试,我已经成立了我的问题答案。 感谢国王萨勒莫从这个话题 图表正在执行的算法,执行以下步骤: 获得他们感兴趣的基色RGB(例如Accent 3) 转换为HSL 将L分量乘以lumMod 将lumOff添加到L组件 转换回RGB 相同的逻辑也适用于satMod,satOff,hueMod和hueOff。 但对于rgb-color,它只有一个值适用于所有级别(如(255,255,255)或(123,123,123))我将lumMod更改为lumMod = lumMod - 0.04(+-0.005) ...
  • 转换为线性RGB没有多大意义,因为HSL是根据伽马编码值定义的。 相反,编写自己的函数将sRGB转换为HSL,用这些值调整饱和度(允许可能超出色域饱和度值),然后转换回sRGB,超出sRGB范围的钳位强度(或不允许饱和度变化无法在sRGB中编码)。 It doesn't make much sense to convert to linear RGB, since HSL is defined in terms of gamma encoded values. Instead, write your own ...
  • 从源头来看,Hue的预期范围确实在0-360之间。 “Hue可以设置为0到100,它不接受超出此范围的值” 那是因为验证码中存在错误 。 该行应该是: if ((a == 1 && result[a] <= 360) || (a > 1 && result[a] <= 100)) { a[1]保持第一个正则表达式模式的捕获值(匹配第一个arg, H ),而不是a[0] 。 为了说明,这里有一个小提琴: http : //jsfiddle.net/vMLZ2/ ps我已经提交了修复的拉取请求 。 与此同时, ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)