Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 654459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:29:48+00:00 2026-05-13T22:29:48+00:00

Before answering, please understand I do NOT want you to do the work for

  • 0

Before answering, please understand I do NOT want you to do the work for me. I would rather appreciate a worded answer as to why my (possibly theoretical) problem exists, and an explanation of the process to go about fixing it. I find it harder to learn properly when someone just does the work for me. Thank you in advance.

I have this function: It does exactly what it looks like it’s doing. It is using the html from a page which contains a facebook ID and returning the ID once found.

def getID(data): #Find an ID from HTML input.
    data = str(data)
    appstring = 'http://apps.facebook.com/castle_age/keep.php?user=' #We're gonna find this in the html.
    appstr_start_pos = data.find(appstring) #Tell us where we found it oh mighty one!
    if appstr_start_pos != -1: #If we find it.
        begin_ID_pos = appstr_start_pos + len(appstring)
        end_ID_pos = data.find('"', begin_ID_pos) #Find the end quote, that'll be the end of our ID string.

        our_ID = data[begin_ID_pos:end_ID_pos]
        return our_ID

Right now I do not have it packaged in one of my classes which uses the thread.Threading method, but I am still calling it regularly. My code right now is only running one thread, and it’s possible that I might need to call this function from another threaded class; is this possible? If not, how can I use this function between threaded classes?

A more simple form of the question: If I call this function from a multi-threaded environment, will I have problems, or do I need to move it into its own class? Is there a way to keep the function available between 2 different threaded objects (if so what’s the easiest way)?

Here is the full code: http://pastebin.com/txH8PvL3 — Please keep in mind that it is a WIP, as practice for learning threading…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:29:48+00:00Added an answer on May 13, 2026 at 10:29 pm

    A more simple form of the question: If I call this function from a multi-threaded environment, will I have problems,

    Yes it is thread-safe from what I can tell

    or do I need to move it into its own class?

    Thread safety has nothing to do with classes: it has to do with shared state. If threads share state, provisions must be made to access/mutate this state in a thread-safe manner i.e. using locks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please read before answering. I dont want you to state the obvious for me.
This is a complex question, please consider carefully before answering. Consider this situation. Two
Before you answer this I have never developed anything popular enough to attain high
Before I start, I know there is this post and it doesn't answer my
Before I do this I figured I would ask if it was the best
Before you start firing at me, I'm NOT looking to do this, but someone
Before I begin, my reason for not using OAuth is I believe it is
Before I started using Git as my SCM, I would throughly test the code
Before any one suggests HTML, I explain later why thats not an option here.
Before I jump headlong into C#... I've always felt that C, or maybe C++,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.