<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>atsuhiro-me</author_name>
  <author_url>https://blog.hatena.ne.jp/atsuhiro-me/</author_url>
  <blog_title>みーのぺーじ</blog_title>
  <blog_url>https://pc.atsuhiro-me.net/</blog_url>
  <categories>
    <anon>Python</anon>
    <anon>Rust</anon>
  </categories>
  <description>シングルトン とは，そのクラスのインスタンスが1つしか生成されないことを保証するデザインパターンのことであり，アプリケーション全体で1つの共通データがあればよい，という時に重宝します． シングルトンが必要になったので作ってみました． 通常のクラスとして使用できる． マルチスレッドに対応する． Pythonで実装 __new__(cls) を利用し，threading.Lock() を追加し，下記のように実装しました． import threading class ThreadSafeSingleton(): _self = None _lock = threading.Lock() def _…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpc.atsuhiro-me.net%2Fentry%2F2020%2F02%2F13%2F022012&quot; title=&quot;シングルトンを実装する - みーのぺーじ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2020-02-13 02:20:12</published>
  <title>シングルトンを実装する</title>
  <type>rich</type>
  <url>https://pc.atsuhiro-me.net/entry/2020/02/13/022012</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
