Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: Threads and object access

by BrowserUk (Patriarch)
on Dec 12, 2002 at 00:07 UTC ( #219219=note: print w/replies, xml ) Need Help??


in reply to Re: Threads and object access
in thread Threads and object access

One mechanism would be to use signals or semaphores and a shared data buffer.

The child thread get its data, puts it into the shared buffer and then signals (semaphores) when it has put something in the buffer to process.

(Win32::Semaphore is one possibility, but there is Threads::Semaphore in 5.8, but I am being a luggard and haven't got around to upgrading yet).

You don't say what the parent thread is doing, but it would need to check (with timeout if necessary) for the semaphore and then take the appropriate action on behalf of the child.


Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.

Replies are listed 'Best First'.
Re: Re: Re: Threads and object access
by Nitrox (Chaplain) on Dec 12, 2002 at 01:44 UTC
    The parent thread is pretty usless and is held in a "by-call state" by the PerlCtrl internals, which is why I was forced to spawn a child to do my polling.

    -Nitrox

      I suppose if you bypassed the problem by creating your Win::OLE object in the child thread, you'd end up with the same problem later when you need to do something with it in the parent?


      Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
      Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
      Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
      Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.

        That's the idea I'm toying with now. The issue I'm going to run into with that implementation is that the Win::OLE object is actually "passed" to my code from the VB app via the RegCallback() routine. I assume that even if I have a child spawned at that point that the PerlCtrl internals will still use the parent thread for subsequent calls from the VB app.

        -Nitrox

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://219219]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2023-09-26 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?