On Sat, Apr 5, 2008 at 8:10 PM, Jim Ursetto <[EMAIL PROTECTED]> wrote:
> Let's say I have two callback handlers registered and within the handlers I do
>  a thread-sleep! or thread-yield!.  The C caller is the same for both (it's a
>  busy handler), they are just invoked with different data.  Now this sequence 
> of
>  events occurs:
>
>  thread 1 enters the callback
>  thread 2 enters the callback
>  thread 1 returns from the callback
>
>  The strange results I get seem to indicate thread 1 is returning to C using 
> the
>  stack of thread 2.
>
>  Is my approach fundamentally flawed?  If this explanation doesn't make sense,
>  I can try to write a self-contained demonstration.
>

Uh oh... This is a case that should probably be avoided. I couldn't even
say what exactly happens, but you will have to do some locking because
the Scheme thread-context will be different when you return from the
callback (as you have described above). When you say "thread 2 enters
the callback" does that mean that a context switch occurs while the
callback is executing? Perhaps you really send some code...


cheers,
felix


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to