Search Results

Search found 2676 results on 108 pages for 'spam blocking'.

Page 32/108 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • Setting up DomainKeys/DKIM in a PHP-based SMTP client

    - by Alex
    It looks like there are some great libraries out there to do DomainKeys signing of emails on C#/.NET, but I'm having a really hard time finding the same kind of support for PHP. Maybe I'm not looking in the right place? The only one I found is http://php-dkim.sourceforge.net/; it looks incredibly hacky and supports PHP4 only. Considering how popular PHP is, and how critical DomainKeys are for email classification as non-spam, I'd expect better tools; do you know of any? Any other tricks you'd recommend?

    Read the article

  • How can I interrupt a ServerSocket accept() method?

    - by lukeo05
    Hi, In my main thread I have a while(listening) loop which calls accept() on my ServerSocket object, then starts a new client thread and adds it to a Collection when a new client is accepted. I also have an Admin thread which I want to use to issue commands, like 'exit', which will cause all the client threads to be shut down, shut itself down, and shut down the main thread, by turning listening to false. However, the accept() call in the while(listening) loop blocks, and there doesn't seem to be any way to interrupt it, so the while condition cannot be checked again and the program cannot exit! Is there a better way to do this? Or some way to interrupt the blocking method? Thanks!

    Read the article

  • The Best solution to sending emails to group members in a social network.

    - by praveen
    I'm developing a social network in php. There is a feature to create custom groups by members and i want to enable the owner of the group to send emails in bulk to all group members. And most importantly i want to make sure that most mails are not going to end up in users' SPAM list. I'm using PHPMailer in my website What should be the best and affordable approach? These are the solutions i came up with. Pls include your own if possible. Using my servers' (hostgator.com) given SMTP server to send emails in bulk Using google apps SMTP (i have even setup SPF for this) Using a third-party to handle my outgoing messages (i.e: mailChimp, iContact ? do they provide APIs ? this is just my idea) Thanks in advance

    Read the article

  • Two BlockingQueue in the same endless loop?

    - by DrDol
    I have a thread, that processes incomming messages (endless loop). For this, I use a BlockingQueue (Java), which works as quite nice. Now, I want to add a second processor in the same Class oder method. The problem now is, that in the endless loop i have this part newIncomming = this.incommingProcessing.take(); This part blocks if the Queue is empty. I'm looking for a solution to process to queues in the same class. The second queue can only processed, it some data is coming in for the first Queue. Is there a way to handle tow blocking queues in the same endless loop?

    Read the article

  • How does one SELECT block another?

    - by Krip
    I'm looking at output of SP_WhoIsActive on SQL Server 2005, and it's telling me one session is blocking another - fine. However they both are running a SELECT. How does one SELECT block another? Shouldn't they both be acquiring shared locks (which are compatible with one another)? Some more details: Neither session has an open transaction count - so they are stand-alone. The queries join a view with a table. They are complex queries which join lots of tables and results in 10,000 or so reads. Any insight much appreciated.

    Read the article

  • C++: static function member shared between threads, can block all?

    - by mhambra
    Hi all, I have a class, which has static function defined to work with C-style extern C { static void callback(foo bar) { } }. // static is defined in header. Three objects (each in separate pthread) are instantiated from this class, each of them has own loop (in class constructor), which can receive the callback. The pointer to function is passed as: x = init_function(h, queue_id, &callback, NULL); while(1) { loop_function(x); } So each thread has the same pointer to &callback. Callback function can block for minutes. Each thread object, excluding the one which got the blocking callback, can call callback again. If the callback function exists only once, then any thread attempting to callback will also block. This would give me an undesired bug, circa is interesting to ask: can anything in C++ become acting this way? Maybe, due to extern { } or some pointer usage?

    Read the article

  • C# change e-mail 'from' address to a user-provided one.

    - by Jeff
    We have an app that allows users to send e-mails from our system. It allows the user to specify their e-mail address, and gives them several standard templates to use as a starting point for their e-mail. When we send the e-mails, we use the address they provided as the 'reply-to', but the 'from' address of the e-mail (naturally) looks like our system (from '[email protected]'). Is there a way to change this without getting tangled up in spam filters or automatic blocking? We'd prefer not to confuse the recipient as to who actually composed the e-mail they've received.

    Read the article

  • How to prevent robots from automatically filling up a form?

    - by sombe
    I'm trying to come up with a good enough anti-spamming mechanism to prevent automatically generated input. I've read that techniques like captcha, 1+1=? stuff work well, but they also present an extra step impeding the free quick use of the application. (I'm not looking for anything like that please). I've tried setting some hidden fields in all of my forms, with display: none; However, I'm almost certain a robot (which is essentially a program) can be configured to trace that form field id and simply not fill it. Do you implement/know of a good anti automatic-form-filling-robots method? Is there something that can be done seamlessly with HTML AND/OR server side processing, and be (almost) foolproof? (and please no JS, one could simply disable it, and there goes my anti-spam method). Btw I'm trying not to rely on sessions for this (like, counting how many times a button is clicked to prevent overloads).

    Read the article

  • A Question about using jython when run a receving socket in python

    - by abusemind
    Hi, I have not a lot of knowledge of python and network programming. Currently I am trying to implement a simple application which can receive a text message sent by the user, fetch some information from the google search api, and return the results via text message to the user. This application will continue to listening to the users messages and reply immediately. How I get the text short message sent by the user? It's a program named fetion from the mobile supplier in China. The client side fetion, just like a instant communication tool, can send/receive messages to/from other people who are using mobile to receive/send SMS. I am using a open source python program that simulates the fetion program. So basically I can use this python program to communate with others who using cell phone via SMS. My core program is based on java, so I need to take this python program into java environment. I am using jython, and now I am available to send messages to users by some lines of java codes. But the real question is the process of receving from users via SMS. In python code, a new thread is created to continuously listen to the user. It should be OK in Python, but when I run the similar process in Jython, the following exception occurs: Exception in thread Thread:Traceback (most recent call last): File "D:\jython2.5.1\Lib\threading.py", line 178, in _Thread__bootstrap self.run() File "<iostream>", line 1389, in run File "<iostream>", line 1207, in receive File "<iostream>", line 1207, in receive File "<iostream>", line 150, in recv File "D:\jython2.5.1\Lib\select.py", line 223, in native_select pobj.register(fd, POLLIN) File "D:\jython2.5.1\Lib\select.py", line 104, in register raise _map_exception(jlx) error: (20000, 'socket must be in non-blocking mode') The line 150 in the python code is as follows: def recv(self,timeout=False): if self.login_type == "HTTP": time.sleep(10) return self.get_offline_msg() pass else: if timeout: infd,outfd,errfd = select([self.__sock,],[],[],timeout)//<---line 150 here else: infd,outfd,errfd = select([self.__sock,],[],[]) if len(infd) != 0: ret = self.__tcp_recv() num = len(ret) d_print(('num',),locals()) if num == 0: return ret if num == 1: return ret[0] for r in ret: self.queue.put(r) d_print(('r',),locals()) if not self.queue.empty(): return self.queue.get() else: return "TimeOut" Because of I am not very familiar with python, especially the socket part, and also new in Jython use, I really need your help or only advice or explanation. Thank you very much!

    Read the article

  • PHP Email Form Sending Random Text

    - by Doug
    Hi, I did a webpage for a client that involved a series of text boxes asking for specific information such as a person's name, e-mail address, company, etc. Along with a button that would e-mail the information to my client. Whenever I tested the button it seemed to work perfectly, I uploaded the page and thought I was done. But, the other day my client got this email from the site: Name: rfhopzdgmx rfhopzdgmx Email: [email protected] Company: zUDXatAfoDvQrdH Mailing Address: AaSsXklqpHIsoCNcei gXsimMPRBYZqq vGLvZraZNdpOAV, ChsmuibE PoKzaSCubXPRI Home Phone: CIJbIfjMfjIaTqAlD Work Phone: JFLZBOvru Cell Phone: XlFJTTFGiTTiiFQfy Fax: UEJMOVZodWPkKxew Comments: sPvSCE hgetwoguderu,* [url=http://atyktjlxcznl.com/]atyktjlxcznl[/url], [link=http://nudvfcehwpyg.com/]nudvfcehwpyg[/link], http://lvvwkbzbhnzp.com/ Note: The * line contained HTML link code, I just don't know how to get this site to show it. Here is the PHP code in the site for the e-mail button. <?php //This Sends A Formatted Text Email Using The Text Boxes if ($_POST['submit']){ //This Gets The Form Data $fname = $_POST['fName']; $lname = $_POST['lName']; $email = $_POST['email']; $company = $_POST['co']; $address1 = $_POST['address1']; $address2 = $_POST['address2']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $homep = $_POST['homeP']; $workp = $_POST['workP']; $cellp = $_POST['cellP']; $fax = $_POST['fax']; $comments = $_POST['txaOutputField']; //echo "<script language = 'javascript'>alert('YAY');</script>"; if ($fname && $lname && $email && $comments){ //Check If Required Fields Are Filled //This Sets The SMTP Configuration In php.ini ini_set("SMTP", "smtp.2ndsourcewire.com"); //This Replaces Any Blank Fields With 'None's if ($company == ""){ $company = "None"; } if ($address1 == ""){ $address1 = "None"; } if ($city == ""){ $city = "None"; } if ($state == ""){ $state = "None"; } if ($zip == ""){ $zip = "None"; } if ($homep == ""){ $homep = "None"; } if ($workp == ""){ $workp = "None"; } if ($cellp == ""){ $cellp = "None"; } if ($fax == ""){ $fax = "None"; } //This Creates The Variables Necessary For The Email $to = "CLIENT EMAIL WHICH I'M CENSORING"; $subject = "Email from 2ndSourceWire.com"; $from = "From: [email protected]"; $secondEmail = "MY EMAIL WHICH I'M ALSO CENSORING"; if ($address2 == ""){ $body = "Name: $fname $lname\n". "Email: $email\n". "Company: $company\n\n". "Mailing Address:\n". "$address1\n". "$city, $state $zip\n\n". "Home Phone: $homep\n". "Work Phone: $workp\n". "Cell Phone: $cellp\n". "Fax: $fax\n\n". "Comments:\n". "$comments"; } else { $body = "Name: $fname $lname\n". "Email: $email\n". "Company: $company\n\n". "Mailing Address:\n". "$address1\n". "$address2\n". "$city, $state $zip\n\n". "Home Phone: $homep\n". "Work Phone: $workp\n". "Cell Phone: $cellp\n". "Fax: $fax\n\n". "Comments:\n". "$comments"; } //This Sends The Email mail($to, $subject, $body, $from); mail($secondEmail, $subject, $body, $from); echo "<script language = 'javascript'>alert('The email was sent successfully.');</script>"; } else { //The Required Fields Are Not Filled echo "<script language = 'javascript'>alert('Please fill your first name, last name, email address, and your comment or question.');</script>"; } } ? I'm a little dumbfounded on how this happened, the client mentioned a couple e-mails of this, so I don't think it is a random glitch. Also, the e-mail address was formatted like an e-mail address, so someone or some program was interpreting the labels next to each text box. I also noticed that the first and last names entered are the same word, even though they were in different text boxes, I'm thinking its some spam program, but wouldn't they try to advertise something and make money, rather than just spouting out random text? Also, the comments section makes no sense to me at all, the links goto nowhere and they're all perfectly formatted, a random person just screwing around wouldn't know those tags, and a programmer doing it wouldn't bother with it, but also neither would a program. I have no idea what caused this or how to fix it, I'm drawing a blank here. Anyone have any ideas?

    Read the article

  • How to create default subfolders using procmail with Maildir (and postfix) that work with MUA's?

    - by user973917
    I have a procmail setup and want to have a Spam folder that works with MUA's. I found this tutorial http://www.cyberciti.biz/faq/how-do-i-move-spam-mail-to-spam-folder/ but it doesn't work as expected. I want to be able to open a mail client and see the Spam folder to deduce whether or not the messages are actually spam. How do I do this having a "default" Spam folder setup that can be read/accessed from mail clients like Thunderbird and Roundcube?

    Read the article

  • Spamassassin: How to delete all spam messages on the server?

    - by Beck
    Can't find out, how to configure spamassassin to delete all spam messages. Currenly it's only mark messages as spam, but pass them throught IMAP to client. How to block them from passing through to IMAP clients? http://spamassassin.apache.org/full/3.3.x/doc/Mail_SpamAssassin_Conf.html And it's blocking some of our notification messages... -1.4 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 HTML_MESSAGE BODY: HTML included in message 2.4 HTML_IMAGE_ONLY_08 BODY: HTML: images with 400-800 bytes of words 2.9 TVD_SPACE_RATIO BODY: TVD_SPACE_RATIO 1.7 MIME_HTML_ONLY BODY: Message only has text/html MIME parts 1.1 HTML_MIME_NO_HTML_TAG HTML-only message, but there is no HTML tag 1.1 HTML_SHORT_LINK_IMG_1 HTML is very short with a linked image -1.4 AWL AWL: From: address is in the auto white-list This is what clients getting on their mails in place of our notification messages. Any idea how to pass those messages through and how to delete incoming spam? Thanks ;) I have this setup: postfix spamassassin clamav-daemon amavis

    Read the article

  • Problem with number/type of arguments passed to an overloaded c++ constructor wrapped with swig.

    - by MiKo
    I am trying to wrap a c++ class (let's call it "Spam") written by someone else with swig to expose it to Python. After solving several problems, I am able to import the module in python, but when I try to create an object of such class I obtain the following error: foo = Spam.Spam('abc',3) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "Spam.py", line 96, in __init__ this = _Spam.new_Spam(*args) NotImplementedError: Wrong number of arguments for overloaded function 'new_Spam'. Possible C/C++ prototypes are: Spam(unsigned char *,unsigned long,bool,unsigned int,SSTree::io_action,char const *) Spam(unsigned char *,unsigned long,bool,unsigned int,SSTree::io_action) Spam(unsigned char *,unsigned long,bool,unsigned int) Spam(unsigned char *,unsigned long,bool) Spam(unsigned char *,unsigned long) Googling around, I realized that the error is probably caused by the type of the arguments and not by the number (which is quite confusing), but I still cannot identify. I suspect the problem lies in passing a string as the first argument, but have no idea on how to fix it (keep in mind that I know almost no c/c++).

    Read the article

  • Twisted: why is it that passing a deferred callback to a deferred thread makes the thread blocking a

    - by surtyaarthoughts
    I unsuccessfully tried using txredis (the non blocking twisted api for redis) for a persisting message queue I'm trying to set up with a scrapy project I am working on. I found that although the client was not blocking, it became much slower than it could have been because what should have been one event in the reactor loop was split up into thousands of steps. So instead, I tried making use of redis-py (the regular blocking twisted api) and wrapping the call in a deferred thread. It works great, however I want to perform an inner deferred when I make a call to redis as I would like to set up connection pooling in attempts to speed things up further. Below is my interpretation of some sample code taken from the twisted docs for a deferred thread to illustrate my use case: #!/usr/bin/env python from twisted.internet import reactor,threads from twisted.internet.task import LoopingCall import time def main_loop(): print 'doing stuff in main loop.. do not block me!' def aBlockingRedisCall(): print 'doing lookup... this may take a while' time.sleep(10) return 'results from redis' def result(res): print res def main(): lc = LoopingCall(main_loop) lc.start(2) d = threads.deferToThread(aBlockingRedisCall) d.addCallback(result) reactor.run() if __name__=='__main__': main() And here is my alteration for connection pooling that makes the code in the deferred thread blocking : #!/usr/bin/env python from twisted.internet import reactor,defer from twisted.internet.task import LoopingCall import time def main_loop(): print 'doing stuff in main loop.. do not block me!' def aBlockingRedisCall(x): if x<5: #all connections are busy, try later print '%s is less than 5, get a redis client later' % x x+=1 d = defer.Deferred() d.addCallback(aBlockingRedisCall) reactor.callLater(1.0,d.callback,x) return d else: print 'got a redis client; doing lookup.. this may take a while' time.sleep(10) # this is now blocking.. any ideas? d = defer.Deferred() d.addCallback(gotFinalResult) d.callback(x) return d def gotFinalResult(x): return 'final result is %s' % x def result(res): print res def aBlockingMethod(): print 'going to sleep...' time.sleep(10) print 'woke up' def main(): lc = LoopingCall(main_loop) lc.start(2) d = defer.Deferred() d.addCallback(aBlockingRedisCall) d.addCallback(result) reactor.callInThread(d.callback, 1) reactor.run() if __name__=='__main__': main() So my question is, does anyone know why my alteration causes the deferred thread to be blocking and/or can anyone suggest a better solution?

    Read the article

  • Is there an use case for non-blocking receive when I have threads?

    - by Gabriel Šcerbák
    I know non-blocking receive is not used as much in message passing, but still some intuition tells me, it is needed. Take for example GUI event driven applications, you need some way to wait for a message in a non-blocking way, so your program can execute some computations. One of the ways to solve this is to have a special thread with message queue. Is there some use case, where you would really need non-blocking receive even if you have threads?

    Read the article

  • Is there a way to ‘join’ (block) in POSIX threads, without exiting the joinee?

    - by elliottcable
    I’m buried in multithreading / parallelism documents, trying to figure out how to implement a threading implementation in a programming language I’ve been designing. I’m trying to map a mental model to the pthreads.h library, but I’m having trouble with one thing: I need my interpreter instances to continue to exist after they complete interpretation of a routine (the language’s closure/function data type), because I want to later assign other routines to them for interpretation, thus saving me the thread and interpreter setup/teardown time. This would be fine, except that pthread_join(3) requires that I call pthread_exit(3) to ‘unblock’ the original thread. How can I block the original thread (when it needs the result of executing the routine), and then unblock it when interpretation of the child routine is complete?

    Read the article

  • Mysql SELECT FOR UPDATE - strange issue

    - by Michal Fronczyk
    Hi, I have a strange issue (at least for me :)) with the MySQL's locking facility. I have a table: Create Table: CREATE TABLE test ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1 With this data: +----+ | id | +----+ | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 10 | | 11 | | 12 | +----+ Now I have 2 clients with these commands executed at the beginning: set autocommit=0; set session transaction isolation level serializable; begin; Now the most interesting part. The first client executes this query: (makes an intent to insert a row with id equal to 9) SELECT * from test where id = 9 FOR UPDATE; Empty set (0.00 sec) Then the second client does the same: SELECT * from test where id = 9 FOR UPDATE; Empty set (0.00 sec) My question is: Why the second client does not block ? An exclusive gap lock should have been set by the first query because FOR UPDATE have been used and the second client should block. If I am wrong, could somebody tell me how to do it correctly ? The MySql version I use is: 5.1.37-1ubuntu5.1 Thanks, Michal

    Read the article

  • Django comments being spammed

    - by John
    Hi, I am using the built in comment system with Django but it has started to be spammed. Can anyone recommend anything I can use to stop this such as captcha for django etc. I'm looking for something that I can use along with the comment system rather than replacing it. Thanks

    Read the article

  • Mixing NIO with IO

    - by Steffen Heil
    Hi Usually you have a single bound tcp port and several connections on these. At least there are usually more connections as bound ports. My case is different: I want to bind a lot of ports and usually have no (or at least very few) connections. So I want to use NIO to accept the incoming connections. However, I need to pass the accepted connections to the existing jsch ssh library. That requires IO sockets instead of NIO sockets, it spawns one (or two) thread(s) per connection. But that's fine for me. Now, I thought that the following lines would deliver the very same result: Socket a = serverSocketChannel.accept().socket(); Socket b = serverSocketChannel.socket().accep(); SocketChannel channel = serverSocketChannel.accpet(); channel.configureBlocking( true ); Socket c = channel.socket(); Socket d = serverSocket.accept(); However the getInputStream() and getOutputStream() functions of the returned sockets seem to work different. Only if the socket was accepted using the last call, jsch can work with it. In the first three cases, it fails (and I am sorry: I don't know why). So is there a way to convert such a socket? Regards, Steffen

    Read the article

  • do you want try ? [closed]

    - by gemxia
    Only with time and hard work, that can you get an IT certification. Although there are hundreds of certifications for you to pick from, the basic steps to get certified are the same. The following steps are certain to clear your puzzles about the preparation process of your <. The first step to take is choosing a certification. It is simple but at the same time very important. Make sure to choose the certifications that are respected in your industries. The second step you should take is to evaluate your experience. Find out what skills and experience the IBM certification is expecting. Then, decide what type of training is suitable for you. Preparation books will certainly not make you an expert in subjects you’re not already an expert in. But, for the subject areas you know little or nothing about, a study guide provides you clues and guidance about what the important information from those subjects is when it comes to passing the Examkiller IBM examination exam. Visit certification forums during your 000-M62 certification exam preparation. In this way, you can learn from others’ mistakes and example, meanwhile help your own studies. Achieving your goals without proper training is a sure road to failure. Knowing about a topic and having special expertise in it are completely different. One cannot be an expert in the IT industry without the proper foundation. Taking a training class for Examkiller IBM exam might be a guaranteed way. When the economy dips and budgets get tightened, one of the first things to go from corporate spending is training. There are plenty of courses, boot camps and cram sessions that promise to prepare you for the IBM exam, but they are exceptionally expensive. As much as possible, for your own benefit, you should look for resources that are free. Vendor of IBM offers free resource in their sites. These practice exams are the closest to the real exams. If you think that you have got ready for the exam, you can take the fourth now, which is registering your exam. Even if you have passed your <, yet you can’t relax, since there are still so many certifications ahead. If you have just memorized some questions and answers, excepting a fluke, then, don’t take the IBM test exam, until you really have the experience and skills the certification requires.

    Read the article

  • Amusing or Sad? Network Solutions

    - by dbasnett
    When I got sick my email ended up in every drug sellers email list. Some days I get over 200 emails selling everything from Viagra to Xanax. Either they don't know what my condition is or they are telling me you are a goner, might as well chill-ax and have a good time. In order to cut down on the mail being downloaded I thought I would add all of the Junk email senders from Outlook to my Network Solution mail server. Much to my amazement I could not find that import Spammers button, so I submitted a tech support request. Here is the response: Thank you for contacting Network Solutions Customer Service Department. We are committed to creating the best Customer experience possible. One of the first ways we can demonstrate our commitment to this goal is to quickly and efficiently handle your recent request. We apologize for any inconvenience this might have caused you. With regard to your concern, please be advised that we cannot import blocked senders in to you e-mail servers. An alternative option is for you to create a Custom Filter that filters unwanted e-mails. To create a Custom Filter: Open a Web browser (e.g., Netscape, Microsoft Internet Explorer, etc.). Type mail.[domain name].[ext] in the address line. Login to your Network Solutions email account. Click on the Configuration left menu tab. Click on the Custom Filter link. Type the rule name. blah, blah, blah Basically add them one at a time. "We are committed to creating the best Customer experience possible." No you are not. You are trying to squeeze every nickle you can out of me. "With regard to your concern, please be advised that we cannot import blocked senders in to you e-mail servers." Maybe I should apply for a job to write those ten complicated lines of code... Maybe I should question my choice of vendors, because if they truly "cannot" then they are to stupid to have my business. It is both amusing and sad. I'll be posting this in every forum I am a member of.

    Read the article

  • Using Microformats but protecting your email (with Javascript).

    - by Lukas Oppermann
    Hey guys, I am using microformats for a project and with this I have the following Problem. I use a Javascript to protect the email addresses, but when saving the microformats as a vCard it puts the javascript code in the email address field. //<![CDATA[ document.write("<n uers="znvygb:vasb100irner56arg">vasb100irner56arg<057n>".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26)}))//]]> Does anyone have any idea how to still protect the email address but use microformats? Thanks in advance.

    Read the article

  • Why does Python's math.factorial not play nice with threads?

    - by W1N9Zr0
    Why does math.factorial act so weird in a thread? Here is an example, it creates three threads: thread that just sleeps for a while thread that increments an int for a while thread that does math.factorial on a large number. It calls start on the threads, then join with a timeout The sleep and spin threads work as expected and return from start right away, and then sit in the join for the timeout. The factorial thread on the other hand does not return from start until it runs to the end! import sys from threading import Thread from time import sleep, time from math import factorial # Helper class that stores a start time to compare to class timed_thread(Thread): def __init__(self, time_start): Thread.__init__(self) self.time_start = time_start # Thread that just executes sleep() class sleep_thread(timed_thread): def run(self): sleep(15) print "st DONE:\t%f" % (time() - time_start) # Thread that increments a number for a while class spin_thread(timed_thread): def run(self): x = 1 while x < 120000000: x += 1 print "sp DONE:\t%f" % (time() - time_start) # Thread that calls math.factorial with a large number class factorial_thread(timed_thread): def run(self): factorial(50000) print "ft DONE:\t%f" % (time() - time_start) # the tests print print "sleep_thread test" time_start = time() st = sleep_thread(time_start) st.start() print "st.start:\t%f" % (time() - time_start) st.join(2) print "st.join:\t%f" % (time() - time_start) print "sleep alive:\t%r" % st.isAlive() print print "spin_thread test" time_start = time() sp = spin_thread(time_start) sp.start() print "sp.start:\t%f" % (time() - time_start) sp.join(2) print "sp.join:\t%f" % (time() - time_start) print "sp alive:\t%r" % sp.isAlive() print print "factorial_thread test" time_start = time() ft = factorial_thread(time_start) ft.start() print "ft.start:\t%f" % (time() - time_start) ft.join(2) print "ft.join:\t%f" % (time() - time_start) print "ft alive:\t%r" % ft.isAlive() And here is the output on Python 2.6.5 on CentOS x64: sleep_thread test st.start: 0.000675 st.join: 2.006963 sleep alive: True spin_thread test sp.start: 0.000595 sp.join: 2.010066 sp alive: True factorial_thread test ft DONE: 4.475453 ft.start: 4.475589 ft.join: 4.475615 ft alive: False st DONE: 10.994519 sp DONE: 12.054668 I've tried this on python 2.6.5 on CentOS x64, 2.7.2 on Windows x86 and the factorial thread does not return from start on either of them until the thread is done executing. I've also tried this with PyPy 1.8.0 on Windows x86, and there result is slightly different. The start does return immediately, but then the join doesn't time out! sleep_thread test st.start: 0.001000 st.join: 2.001000 sleep alive: True spin_thread test sp.start: 0.000000 sp DONE: 0.197000 sp.join: 0.236000 sp alive: False factorial_thread test ft.start: 0.032000 ft DONE: 9.011000 ft.join: 9.012000 ft alive: False st DONE: 12.763000

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >