--- /dev/null
+/*
+* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice (including the next
+* paragraph) shall be included in all copies or substantial portions of the
+* Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*/
+
+#include "DSUtilSocket.h"
+
+namespace display_server
+{
+
+/* reference count, mutex and compositor pointer for DSUtilSocket singleton */
+int DSUtilSocket::__refCount { 0 };
+std::mutex DSUtilSocket::__mutex;
+DSUtilSocket* DSUtilSocket::__utilSocket { nullptr };
+
+DSUtilSocket::DSUtilSocket()
+{
+}
+
+DSUtilSocket::~DSUtilSocket()
+{
+}
+
+/* getInstance for DSUtilSocket singleton */
+//static
+DSUtilSocket *DSUtilSocket::getInstance()
+{
+ std::lock_guard<std::mutex> tLock(__mutex);
+
+ DSLOG_INF("DSUtilSocket",
+ "[Get] instance __refCount=%d !", __refCount);
+
+ if (!__utilSocket && (__refCount == 0))
+ {
+ __utilSocket = new DSUtilSocket();
+ DSLOG_INF("DSUtilSocket",
+ "DSUtilSocket instance has been created !");
+ }
+
+ ++__refCount;
+ return __utilSocket;
+}
+
+/* releaseInstance for DSUtilSocket singleton */
+// static
+void DSUtilSocket::releaseInstance()
+{
+ std::lock_guard<std::mutex> tLock(__mutex);
+
+ --__refCount;
+ if (__refCount < 0)
+ __refCount = 0;
+ DSLOG_INF("DSUtilSocket",
+ "[Release] instance __refCount=%d !", __refCount);
+
+ if ((0 == __refCount) && __utilSocket)
+ {
+ delete __utilSocket;
+ __utilSocket = nullptr;
+ DSLOG_INF("DSUtilSocket",
+ "DSUtilSocket instance has been removed !");
+ }
+}
+
+
+}
--- /dev/null
+/*
+* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice (including the next
+* paragraph) shall be included in all copies or substantial portions of the
+* Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef __DS_UTIL_SOCKET_H_
+#define __DS_UTIL_SOCKET_H_
+
+#include <DSCore.h>
+
+namespace display_server
+{
+
+class DSUtilSocket
+{
+public:
+ static DSUtilSocket *getInstance();
+ static void releaseInstance();
+
+private:
+ DSUtilSocket();
+ ~DSUtilSocket();
+ DSUtilSocket& operator=(const DSUtilSocket&) = delete;
+
+ static std::mutex __mutex;
+ static DSUtilSocket *__utilSocket;
+ static int __refCount;
+};
+
+}
+
+#endif