fsqueue. ¼øÀ§ ¹× ¿ä¾à
- °Ô½ÃÀÚ À̸§:
- FUKUDA Masahiro
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://fukuda.org
fsqueue. ű×
fsqueue. ¼³¸í
ÆÄÀÏ ½Ã½ºÅÛÀ» ±â¹ÝÀ¸·ÎÇϴ ź¼º Å¥ FSQueue´Â ź·ÂÀû ÀÎ µ¿±âÈ µÈ Å¥ ÆÄÀ̽ã Ŭ·¡½ºÀÔ´Ï´Ù. Quick ¿¹Á¦ : ¿¹ : import sysfrom ¸ÖƼ ÇÁ·Î¼¼½Ì °¡Á® ¿À±â processfrom fsqueue °¡Á® ¿À±â queuefrom ½Ã°£ °¡Á® ¿À±â sleepdef put (q, num) : xrange (num)¿¡¼ "put : % d"% i sys.stdout.flush () q.put (i) def get (q, num) : xrange (num)¿¡¼ iÀÇ °æ¿ì : sys.stdout.flush () Àμâ "get : % d % d"% (i, q .get ()) q.task_done () def process_test () : q = queue (init = true) p0 = ÇÁ·Î¼¼½º (target = put, args = (q, 1000)) p0.start () p0.join () p1 = ÇÁ·Î¼¼½º (Target = get, args = (q, 500)) p2 = ÇÁ·Î¼¼½º (target = get, args = (q, 500)) p1.start () p2.start () p1.join () p2.join ( ) Q.Empty ()°¡ ¾Æ´Ñ °æ¿ì Àμâ "´ë±â¿ÀÌ ºñ¾î ÀÖ¾î¾ßÇÕ´Ï´Ù." exceptionif __name__ == '__main__': process_test ()
fsqueue. °ü·Ã ¼ÒÇÁÆ®¿þ¾î