Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. How can you make "Singleton" pattern to "Nton"?

How can you make "Singleton" pattern to "Nton"?

Scheduled Pinned Locked Moved The Lounge
regexquestion
17 Posts 11 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W wizardzz

    Shame on us, someone pretty high ranking uni'd this guy. Where is the spirit of helping a new member, who formulated an actual intelligible question but happened to post in the wrong place?

    "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

    H Offline
    H Offline
    hairy_hats
    wrote on last edited by
    #8

    You must be new here... (and it wasn't me).

    1 Reply Last reply
    0
    • W wizardzz

      Shame on us, someone pretty high ranking uni'd this guy. Where is the spirit of helping a new member, who formulated an actual intelligible question but happened to post in the wrong place?

      "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

      C Offline
      C Offline
      Corporal Agarn
      wrote on last edited by
      #9

      May 2007 new member?

      W 1 Reply Last reply
      0
      • L Lost User

        How can you make "Singleton" pattern to "Nton"? MEANS: you explicitly define that how many times an static is allowed to initialize?

        R Offline
        R Offline
        Rick Shaub
        wrote on last edited by
        #10

        ham_gr80 wrote:

        How can you make "Singleton" pattern to "Nton"?

        Don't use a sync lock and call GetInstance() from mutlithreaded code?

        1 Reply Last reply
        0
        • C Corporal Agarn

          May 2007 new member?

          W Offline
          W Offline
          wizardzz
          wrote on last edited by
          #11

          New as in, he has only posted one other question, one comment, and five messages. New is not only a measurement of time, it also can mean inexperienced or unaccustomed.

          "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

          1 Reply Last reply
          0
          • L Lost User

            How can you make "Singleton" pattern to "Nton"? MEANS: you explicitly define that how many times an static is allowed to initialize?

            G Offline
            G Offline
            GlobX
            wrote on last edited by
            #12

            See here[^].


            Typical n-tiered architecture: DB <-> Junk(0) <-> ... <-> Junk(n-1) <-> Pretty

            1 Reply Last reply
            0
            • L Lost User

              How can you make "Singleton" pattern to "Nton"? MEANS: you explicitly define that how many times an static is allowed to initialize?

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #13

              Is that not a 'pool'? Like in ConnectionPool or ThreadPool?

              "Dark the dark side is. Very dark..." - Yoda ---
              "Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi

              S L 2 Replies Last reply
              0
              • L Lost User

                Is that not a 'pool'? Like in ConnectionPool or ThreadPool?

                "Dark the dark side is. Very dark..." - Yoda ---
                "Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi

                S Offline
                S Offline
                Single Step Debugger
                wrote on last edited by
                #14

                In the pool, by idea, you have unlimited number of instances of the object/thread.

                There is only one Ashley Judd and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                1 Reply Last reply
                0
                • L Lost User

                  Is that not a 'pool'? Like in ConnectionPool or ThreadPool?

                  "Dark the dark side is. Very dark..." - Yoda ---
                  "Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #15

                  Yes, it can be done with something like connection pool with round robin manner.

                  1 Reply Last reply
                  0
                  • M Maximilien

                    (you should have posted this in the Question&Answer section. How about using a counter ?

                    Watched code never compiles.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #16

                    Ohh, my mistake.

                    1 Reply Last reply
                    0
                    • N Nemanja Trifunovic

                      You add a counter that tracks the number of instantiations?

                      utf8-cpp

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #17

                      Exactly, i am also thinking like that. It can be done by counting the instantiation of static reference. But one more thing which has to be focus is clear the first instantiated reference to make it able to reassign again.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups