{"id":388,"date":"2022-07-15T22:26:13","date_gmt":"2022-07-15T13:26:13","guid":{"rendered":"https:\/\/www.bees-team.com\/?p=388"},"modified":"2022-07-18T18:40:45","modified_gmt":"2022-07-18T09:40:45","slug":"python-multithread-queue-file","status":"publish","type":"post","link":"https:\/\/www.bees-team.com\/?p=388","title":{"rendered":"Python &#8211; Multithread &#8211; Queue &#8211; File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue)"},"content":{"rendered":"<div class=\"post-content\"><div class='booster-block booster-read-block'>\n                <div class=\"twp-read-time\">\n                \t<i class=\"booster-icon twp-clock\"><\/i> <span>Read Time:<\/span>3 Minute, 12 Second                <\/div>\n\n            <\/div><h2>M\u1ee5c l\u1ee5c<\/h2>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><a href=\"https:\/\/www.bees-team.com\/?p=388#ta-toc-1\">D\u1eabn nh\u1eadp b\u00e0i to\u00e1n.<\/a><\/li>\n<li><a href=\"https:\/\/www.bees-team.com\/?p=388#ta-toc-2\">Input data.<\/a><\/li>\n<li><a href=\"https:\/\/www.bees-team.com\/?p=388#ta-toc-3\">Source code.<\/a><\/li>\n<li><a href=\"https:\/\/www.bees-team.com\/?p=388#ta-toc-4\">Output data.<\/a><\/li>\n<li><a href=\"https:\/\/www.bees-team.com\/?p=388#ta-toc-5\">Video h\u01b0\u1edbng d\u1eabn t\u1eebng b\u01b0\u1edbc c\u1ee5 th\u1ec3.<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2><span id=\"ta-toc-1\">D\u1eabn nh\u1eadp b\u00e0i to\u00e1n.<\/span><\/h2>\n<p>N\u1ebfu l\u00e0 d\u00e2n IT th\u00ec ch\u00fang ta ch\u1eafc l\u00e0 ch\u00fang ta \u0111\u00e3 \u0111\u01b0\u1ee3c l\u00e0m quen v\u1edbi kh\u00e1i ni\u1ec7m \u0111a lu\u1ed3ng d\u01b0\u1edbi m\u00e1i tr\u01b0\u1eddng \u0111\u1ea1i h\u1ecdc, khi h\u1ecdc v\u1ec1 h\u1ec7 \u0111i\u1ec1u h\u00e0nh&#8230; Khi \u0111i l\u00e0m ch\u1eafc c\u0169ng c\u00f3 nhi\u1ec1u ng\u01b0\u1eddi c\u0169ng \u0111\u1ed7 m\u1ed3 h\u00f4i tr\u00e1n v\u1edbi n\u00f3.<\/p>\n<p>\u1ede b\u00e0i vi\u1ebft n\u00e0y m\u00ecnh th\u1eed l\u00e0m m\u1ed9t b\u00e0i t\u1eadp \u0111\u01a1n gi\u1ea3n v\u1ec1 x\u1eed l\u00fd \u0111a lu\u1ed3ng.<\/p>\n<p>V\u1ec1 x\u1eed l\u00fd \u0111a lu\u1ed3ng th\u00ec th\u1ef1c t\u1ebf n\u00f3 c\u0169ng gi\u1ed1ng nh\u01b0 x\u1eed l\u00fd \u0111\u01a1n lu\u1ed3ng m\u00e0 th\u00f4i. N\u00f3 ch\u1ec9 g\u1eb7p r\u1eafc r\u1ed1i khi c\u00e1c lu\u1ed3ng \u0111\u00f3 c\u00f9ng truy c\u1eadp s\u1eed d\u1ee5ng chung 1 t\u00e0i nguy\u00ean n\u00e0o \u0111\u00f3 nh\u01b0 File hay l\u00e0 Speaker&#8230; C\u0169ng nh\u01b0 th\u1ebf gi\u1edbi th\u1ef1c b\u00ean ngo\u00e0i, l\u00fac c\u00f2n l\u00e0 sinh vi\u00ean \u0111\u1ea7u th\u00e1ng c\u00f3 ti\u1ec1n th\u00ec m\u1ed7i th\u1eb1ng m\u1ed9t \u0111i\u1ebfu 3 s\u1ed1 ph\u00ec ph\u00e0. \u0110\u1ebfn cu\u1ed1i th\u00e1ng h\u1ebft ti\u1ec1n ch\u1ec9 c\u00f2n 1 \u0111i\u1ebfu thu\u1ed1c m\u00e0 2 th\u1eb1ng \u0111\u1ec1u mu\u1ed1n h\u00fat. V\u1eady l\u00e0 c\u1ee9 thay phi\u00ean nhau m\u1ed7i th\u1eb1ng k\u00e9o m\u1ed9t h\u01a1i.<\/p>\n<p>V\u00e0 \u0111a lu\u1ed3ng c\u0169ng th\u1ebf, khi c\u1ea7n truy c\u1eadp v\u00e0o c\u00f9ng m\u1ed9t File hay m\u1ed9t record trong DB th\u00ec c\u0169ng di\u1ec5n ra nh\u01b0 v\u1eady. Thay phi\u00ean tu\u1ea7n t\u1ef1 m\u00e0 th\u00f4i.<\/p>\n<p>Khi n\u00f3i v\u1ec1 thay phi\u00ean tu\u1ea7n t\u1ef1, ch\u00fang ta c\u00f3 th\u1ec3 li\u00ean t\u01b0\u1edfng t\u1edbi h\u00e0ng \u0111\u1ee3i. Gi\u1ed1ng nh\u01b0 x\u1ebfp h\u00e0ng mua v\u00e9 xem seagame, v\u00e0o tr\u01b0\u1edbc \u0111\u01b0\u1ee3c tr\u01b0\u1edbc v\u00e0o sau th\u00ec \u0111\u01b0\u1ee3c sau. (\u0110\u00f4i khi c\u00f3 ngo\u1ea1i l\u1ec7, v\u1edbi m\u1ea5y anh d\u1ea1i g\u00e1i \ud83d\ude42 )<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-397\" src=\"http:\/\/www.bees-team.com\/wp-content\/uploads\/2022\/07\/queuearray-animation.gif\" alt=\"\" width=\"612\" height=\"252\" \/><\/p>\n<p>\u1ede source code b\u00ean d\u01b0\u1edbi, m\u00ecnh th\u1ef1c hi\u1ec7n x\u1eed l\u00fd:<\/p>\n<p>\u2460\u0110\u1ecdc data t\u1eeb file in.txt v\u00e0o Input Queue<\/p>\n<p>\u2461T\u1ea1o 2 thread d\u00f9ng chung data \u1edf Input Queue, l\u1ea5y t\u1eebng ph\u1ea7n t\u1eed trong Input Queue r\u1ed3i add v\u1edbi t\u00ean c\u1ee7a thread r\u1ed3i \u0111\u1ed5 v\u00e0o Output Queue.<\/p>\n<p>\u2462Sau khi x\u1ee9 l\u00fd xong th\u00ec ghi data c\u1ee7a Output Queue xu\u1ed1ng file out.txt.<\/p>\n<h2><span id=\"ta-toc-2\">Input data.<\/span><\/h2>\n<p><strong>B\u00ean d\u01b0\u1edbi l\u00e0 n\u1ed9i dung c\u1ee7a file c:\/learn_python\/in.txt ch\u1ee9a data \u0111\u1ea7u v\u00e0o.<\/strong><\/p>\n<pre>1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20\r\n<\/pre>\n<h2><span id=\"ta-toc-3\">Source code.<\/span><\/h2>\n<pre>import threading\r\n#L\u01b0u \u00fd v\u1edbi python 2.x th\u00ec l\u00e0 import Queue, python 3.x import queue\r\nimport queue\r\nimport time\r\n#Khai b\u00e1o 1 \u0111\u1ed1i t\u01b0\u1ee3ng queue.\r\ninQueue = queue.Queue()\r\noutQueue = queue.Queue()\r\n\r\n\r\ndef inPutTasks():\r\n    with open('c:\/learn_python\/in.txt') as inFile:\r\n        contents = inFile.readline()\r\n        inQueue.put(contents)\r\n        while contents:\r\n            contents = inFile.readline()\r\n            inQueue.put(contents)\r\n\r\n# Khai b\u00e1o Fuction x\u1eed l\u00fd add string v\u00e0o Queue\r\ndef processTask(name): \r\n    while not inQueue.empty(): \r\n        value = inQueue.get()\r\n        outQueue.put(name + \":\" + value)\r\n        time.sleep(0.16)\r\n\r\n# Khai b\u00e1o Fuction x\u1eed l\u00fd ghi gi\u00e1 tr\u1ecb c\u1ee7a Queue xu\u1ed1ng File.\r\ndef outPutTasks():\r\n    # sleep 3s \u0111\u1ec3 \u0111\u1ee3i c\u00e1c thread kh\u00e1c x\u1ee9 l\u00fd xong r\u1ed3i xu\u1ea5t ra file.\r\n    time.sleep(3)\r\n    with open('c:\/learn_python\/out.txt', \"w\") as outFile:\r\n        while not outQueue.empty(): \r\n            msg = outQueue.get()\r\n            print(msg)\r\n            outFile.write(msg)\r\n\r\n# Khai b\u00e1o thread ghi file\r\noutThread = threading.Thread(target=outPutTasks)\r\n\r\n# Khai b\u00e1o thread l\u1ea5y data t\u1eeb file in.txt\r\ninThread = threading.Thread(target=inPutTasks)\r\n# Khai b\u00e1o thread A \r\nthreadA = threading.Thread(target=processTask, args=(\"a\",))\r\n\r\n# Khai b\u00e1o thread B\r\nthreadB = threading.Thread(target=processTask, args=(\"b\",))\r\n\r\n# Start thread\r\ninThread.start()\r\nthreadA.start()\r\n\r\n# D\u1eebng x\u1eed l\u00fd 0.02s \u0111\u1ec3 t\u1ea1o \u0111\u1ed9 l\u1ec7ch x\u1eed l\u00fd\r\ntime.sleep(0.02)\r\nthreadB.start()\r\noutThread.start()\r\n\r\n# \u0110\u1ee3i thread k\u1ebft th\u00fac.\r\noutThread.join()<\/pre>\n<h2><span id=\"ta-toc-4\">Output data.<\/span><\/h2>\n<p><strong>B\u00ean d\u01b0\u1edbi l\u00e0 n\u1ed9i dung c\u1ee7a file c:\/learn_python\/out.txt ch\u1ee9a data \u0111\u1ea7u ra khi c\u00e1c thread x\u1eed l\u00fd xong.<\/strong><\/p>\n<pre>a:1\r\nb:2\r\na:3\r\nb:4\r\nb:5\r\na:6\r\na:7\r\nb:8\r\na:9\r\nb:10\r\na:11\r\nb:12\r\na:13\r\nb:14\r\na:15\r\nb:16\r\nb:17\r\na:18\r\na:19\r\nb:10\r\n<\/pre>\n<h2><span id=\"ta-toc-5\">Video h\u01b0\u1edbng d\u1eabn t\u1eebng b\u01b0\u1edbc c\u1ee5 th\u1ec3.<\/span><\/h2>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/lTvBuQoHWP0\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><span data-mce-type=\"bookmark\" style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" class=\"mce_SELRES_start\">\ufeff<\/span><\/iframe><\/p>\n        <div class=\"booster-block booster-reactions-block\">\n            <div class=\"twp-reactions-icons\">\n                \n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-1\" post-id=\"388\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/happy.svg\" alt=\"Happy\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Happy                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                        \n                                                <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-2\" post-id=\"388\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/sad.svg\" alt=\"Sad\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Sad                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-3\" post-id=\"388\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/excited.svg\" alt=\"Excited\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Excited                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-6\" post-id=\"388\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/sleepy.svg\" alt=\"Sleepy\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Sleepy                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                        \n                                                <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-4\" post-id=\"388\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/angry.svg\" alt=\"Angry\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">Angry<\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                        \n                    <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-5\" post-id=\"388\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/surprise.svg\" alt=\"Surprise\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">Surprise<\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">2<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>100<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n            <\/div>\n        <\/div>\n\n    <\/div>","protected":false},"excerpt":{"rendered":"<p>M\u1ee5c l\u1ee5c D\u1eabn nh\u1eadp b\u00e0i to\u00e1n. Input data. Source code.<a href=\"https:\/\/www.bees-team.com\/?p=388\">Read More<i class=\"fa fa-long-arrow-right\" aria-hidden=\"true\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":395,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-388","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-experiment-about-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python - Multithread - Queue - File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue) - Experiment Log<\/title>\n<meta name=\"description\" content=\"Python - Multithread - Queue - File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue)\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python - Multithread - Queue - File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue) - Experiment Log\" \/>\n<meta property=\"og:description\" content=\"Python - Multithread - Queue - File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue)\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bees-team.com\/?p=388\" \/>\n<meta property=\"og:site_name\" content=\"Experiment Log\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-15T13:26:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-18T09:40:45+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.bees-team.com\/wp-content\/uploads\/2022\/07\/python_multithread.png\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"348\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Bees-Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bees-Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=388#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=388\"},\"author\":{\"name\":\"Bees-Team\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#\\\/schema\\\/person\\\/974321230684f994b6f3a28aa132b197\"},\"headline\":\"Python &#8211; Multithread &#8211; Queue &#8211; File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue)\",\"datePublished\":\"2022-07-15T13:26:13+00:00\",\"dateModified\":\"2022-07-18T09:40:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=388\"},\"wordCount\":551,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=388#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.bees-team.com\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/python_multithread.png\",\"articleSection\":[\"Python Advance\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.bees-team.com\\\/?p=388#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=388\",\"url\":\"https:\\\/\\\/www.bees-team.com\\\/?p=388\",\"name\":\"Python - Multithread - Queue - File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue) - Experiment Log\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=388#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=388#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.bees-team.com\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/python_multithread.png\",\"datePublished\":\"2022-07-15T13:26:13+00:00\",\"dateModified\":\"2022-07-18T09:40:45+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#\\\/schema\\\/person\\\/974321230684f994b6f3a28aa132b197\"},\"description\":\"Python - Multithread - Queue - File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue)\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=388#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bees-team.com\\\/?p=388\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=388#primaryimage\",\"url\":\"https:\\\/\\\/www.bees-team.com\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/python_multithread.png\",\"contentUrl\":\"https:\\\/\\\/www.bees-team.com\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/python_multithread.png\",\"width\":640,\"height\":348},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=388#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.bees-team.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python &#8211; Multithread &#8211; Queue &#8211; File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#website\",\"url\":\"https:\\\/\\\/www.bees-team.com\\\/\",\"name\":\"Experiment Log\",\"description\":\"Just note what I did\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bees-team.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#\\\/schema\\\/person\\\/974321230684f994b6f3a28aa132b197\",\"name\":\"Bees-Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g\",\"caption\":\"Bees-Team\"},\"sameAs\":[\"https:\\\/\\\/www.bees-team.com\\\/\"],\"url\":\"https:\\\/\\\/www.bees-team.com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python - Multithread - Queue - File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue) - Experiment Log","description":"Python - Multithread - Queue - File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue)","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Python - Multithread - Queue - File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue) - Experiment Log","og_description":"Python - Multithread - Queue - File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue)","og_url":"https:\/\/www.bees-team.com\/?p=388","og_site_name":"Experiment Log","article_published_time":"2022-07-15T13:26:13+00:00","article_modified_time":"2022-07-18T09:40:45+00:00","og_image":[{"width":640,"height":348,"url":"http:\/\/www.bees-team.com\/wp-content\/uploads\/2022\/07\/python_multithread.png","type":"image\/png"}],"author":"Bees-Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Bees-Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bees-team.com\/?p=388#article","isPartOf":{"@id":"https:\/\/www.bees-team.com\/?p=388"},"author":{"name":"Bees-Team","@id":"https:\/\/www.bees-team.com\/#\/schema\/person\/974321230684f994b6f3a28aa132b197"},"headline":"Python &#8211; Multithread &#8211; Queue &#8211; File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue)","datePublished":"2022-07-15T13:26:13+00:00","dateModified":"2022-07-18T09:40:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bees-team.com\/?p=388"},"wordCount":551,"commentCount":0,"image":{"@id":"https:\/\/www.bees-team.com\/?p=388#primaryimage"},"thumbnailUrl":"https:\/\/www.bees-team.com\/wp-content\/uploads\/2022\/07\/python_multithread.png","articleSection":["Python Advance"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.bees-team.com\/?p=388#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.bees-team.com\/?p=388","url":"https:\/\/www.bees-team.com\/?p=388","name":"Python - Multithread - Queue - File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue) - Experiment Log","isPartOf":{"@id":"https:\/\/www.bees-team.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.bees-team.com\/?p=388#primaryimage"},"image":{"@id":"https:\/\/www.bees-team.com\/?p=388#primaryimage"},"thumbnailUrl":"https:\/\/www.bees-team.com\/wp-content\/uploads\/2022\/07\/python_multithread.png","datePublished":"2022-07-15T13:26:13+00:00","dateModified":"2022-07-18T09:40:45+00:00","author":{"@id":"https:\/\/www.bees-team.com\/#\/schema\/person\/974321230684f994b6f3a28aa132b197"},"description":"Python - Multithread - Queue - File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue)","breadcrumb":{"@id":"https:\/\/www.bees-team.com\/?p=388#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bees-team.com\/?p=388"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bees-team.com\/?p=388#primaryimage","url":"https:\/\/www.bees-team.com\/wp-content\/uploads\/2022\/07\/python_multithread.png","contentUrl":"https:\/\/www.bees-team.com\/wp-content\/uploads\/2022\/07\/python_multithread.png","width":640,"height":348},{"@type":"BreadcrumbList","@id":"https:\/\/www.bees-team.com\/?p=388#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.bees-team.com\/"},{"@type":"ListItem","position":2,"name":"Python &#8211; Multithread &#8211; Queue &#8211; File: X\u1eed l\u00fd \u0111a lu\u1ed3ng d\u00f9ng chung d\u1eef li\u1ec7u tr\u00ean c\u00f9ng m\u1ed9t file d\u00f9ng h\u00e0ng \u0111\u1ee3i(Queue)"}]},{"@type":"WebSite","@id":"https:\/\/www.bees-team.com\/#website","url":"https:\/\/www.bees-team.com\/","name":"Experiment Log","description":"Just note what I did","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bees-team.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.bees-team.com\/#\/schema\/person\/974321230684f994b6f3a28aa132b197","name":"Bees-Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g","caption":"Bees-Team"},"sameAs":["https:\/\/www.bees-team.com\/"],"url":"https:\/\/www.bees-team.com\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/posts\/388","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=388"}],"version-history":[{"count":17,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/posts\/388\/revisions"}],"predecessor-version":[{"id":409,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/posts\/388\/revisions\/409"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/media\/395"}],"wp:attachment":[{"href":"https:\/\/www.bees-team.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}