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. Other Discussions
  3. IT & Infrastructure
  4. Error in MSDN Example

Error in MSDN Example

Scheduled Pinned Locked Moved IT & Infrastructure
comdata-structuresperformancehelptutorial
4 Posts 3 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.
  • R Offline
    R Offline
    Rupel
    wrote on last edited by
    #1

    i was just reading the MSDN-Library on Events for Thread-Synchronization and stumbled across the following code:

    #define NUMTHREADS 4
    //...
    HANDLE hReadEvents[NUMTHREADS] // ...
    DWORD i // ...
    for(i = 1; i <= NUMTHREADS; i++)
    {
    hReadEvents[i] = CreateEvent( // ...

    i mean - does anyone check these examples? obviously this code accesses memory beyond the array-boundaries: hReadEvents[4] in the last loop. :wtf: see here: Using Event Objects it's in the first code example or am i missing something? :confused: :wq

    M J 2 Replies Last reply
    0
    • R Rupel

      i was just reading the MSDN-Library on Events for Thread-Synchronization and stumbled across the following code:

      #define NUMTHREADS 4
      //...
      HANDLE hReadEvents[NUMTHREADS] // ...
      DWORD i // ...
      for(i = 1; i <= NUMTHREADS; i++)
      {
      hReadEvents[i] = CreateEvent( // ...

      i mean - does anyone check these examples? obviously this code accesses memory beyond the array-boundaries: hReadEvents[4] in the last loop. :wtf: see here: Using Event Objects it's in the first code example or am i missing something? :confused: :wq

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      Heh, that's pretty funny. Use the "What did you think of this topic?" link at the bottom of the page to report the error. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt "That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."   -- Buffy

      R 1 Reply Last reply
      0
      • M Michael Dunn

        Heh, that's pretty funny. Use the "What did you think of this topic?" link at the bottom of the page to report the error. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt "That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."   -- Buffy

        R Offline
        R Offline
        Rupel
        wrote on last edited by
        #3

        roger that! i sent an email. thx for the hint. :) :wq

        1 Reply Last reply
        0
        • R Rupel

          i was just reading the MSDN-Library on Events for Thread-Synchronization and stumbled across the following code:

          #define NUMTHREADS 4
          //...
          HANDLE hReadEvents[NUMTHREADS] // ...
          DWORD i // ...
          for(i = 1; i <= NUMTHREADS; i++)
          {
          hReadEvents[i] = CreateEvent( // ...

          i mean - does anyone check these examples? obviously this code accesses memory beyond the array-boundaries: hReadEvents[4] in the last loop. :wtf: see here: Using Event Objects it's in the first code example or am i missing something? :confused: :wq

          J Offline
          J Offline
          Jorgen Sigvardsson
          wrote on last edited by
          #4

          It looks like a VB-programmer has been messing with C++ .. :-D -- Seraphim Shock. Gold for your ears.

          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