Ticket #1319 (closed defect: fixed)
threading test locks up python on windows
| Reported by: | sgillies@… | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | MapScript | Version: | 4.5 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
But passes on Linux. In the windows case, mapserver was build with /MD and
USE_THREAD. Here is the test (tests/cases/threadtest.py 1.6):
import os, sys
import unittest
# the testing module helps us import the pre-installed mapscript
from testing import mapscript, TESTMAPFILE
def make_map(i):
print "making map in thread %d" % (i)
print mapscript.MS_ON
po = mapscript.pointObj(1,1)
print po
class MultipleThreadsTestCase(unittest.TestCase):
def testLayerAdditionMultiThreads(self):
"""mapscripting in multiple threads"""
import threading
workers = []
for i in range(10):
thread = threading.Thread(target=make_map, args=(i,))
workers.append(thread)
thread.start()
for thread in workers:
print "waiting ... " + str(thread)
thread.join()
print str(thread) + " done."
# -----------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()
the make_map() function is run by the 10 "worker" threads. Curious that even
an operation as simple as init-ing a pointObj hangs. Note that printing the
module variable mapscript.MS_ON works just fine by itself. I also substituted
code from a non-mapscript module into make_map() and had no problems at all.
Change History
Note: See
TracTickets for help on using
tickets.
