[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] win32-thread 0.0.1 (or, do you feel lucky?

djberg96

12/14/2004 6:35:00 AM

Hi all,

I've released the highly experimental first version of win32-thread.
This code is ultra-alpha, and has already been banned in 37 countries.
Oh, but not yours.

What is it?
===========
A probably-naive attempt to wrap native Win32 threads for Ruby.

Where is it?
============
You can find in on the RAA or on the Win32Utils project page at
http://www.rubyforge.org/projects/....

What's wrong with it?
=====================
It only works for simple cases. Attempting to create more than one
native thread causes application errors and/or segfaults. Not too
useful at the moment, but barrels of fun. Good at parties.

So why did you put it out?
==========================
For kicks mainly, and for brave folks to tinker with. I'm also hoping
someone out there smarter than me might take a look and find a way to
make it better. :)

Enjoy!

- Dan

8 Answers

Nick

12/14/2004 12:44:00 PM

0


Fascinating... Is ruby native thread-friendly? Without the ability to
keep multiple interpreter contexts, I would think this would cause the
interpreter to go crazy. ("No thread context and no beer make Ruby go
something something...").

Nick

Daniel Berger wrote:
> Hi all,
>
> I've released the highly experimental first version of win32-thread.
> This code is ultra-alpha, and has already been banned in 37 countries.
> Oh, but not yours.
>
> What is it?
> ===========
> A probably-naive attempt to wrap native Win32 threads for Ruby.
>
> Where is it?
> ============
> You can find in on the RAA or on the Win32Utils project page at
> http://www.rubyforge.org/projects/....
>
> What's wrong with it?
> =====================
> It only works for simple cases. Attempting to create more than one
> native thread causes application errors and/or segfaults. Not too
> useful at the moment, but barrels of fun. Good at parties.
>
> So why did you put it out?
> ==========================
> For kicks mainly, and for brave folks to tinker with. I'm also hoping
> someone out there smarter than me might take a look and find a way to
> make it better. :)
>
> Enjoy!
>
> - Dan
>
>
>
>
>



nobu.nokada

12/14/2004 2:22:00 PM

0

Hi,

At Tue, 14 Dec 2004 21:44:08 +0900,
Nick wrote in [ruby-talk:123582]:
> Fascinating... Is ruby native thread-friendly? Without the ability to
> keep multiple interpreter contexts, I would think this would cause the
> interpreter to go crazy. ("No thread context and no beer make Ruby go
> something something...").

Not at all. GC occurred in another thread causes a crash
immediately.

--
Nobu Nakada


Nick

12/14/2004 2:37:00 PM

0

nobu.nokada@softhome.net wrote:

> Not at all. GC occurred in another thread causes a crash
> immediately.
>

Thats what I thought. Does anybody know if there any intention to create
"thread-context" structures so the interpreter can run in multiple
thread contexts in a future ruby version?

Nick


Wayne Vucenic

12/15/2004 8:35:00 PM

0

<nobu.nokada@softhome.net> wrote:
> Not at all. GC occurred in another thread causes a crash
> immediately.

Is GC the main problem with using native threads?

If so, some applications might be able to make do with a scheme where
the program alternates between two states:

State 1: GC gets disabled, and the native threads are allowed to run
State 2: All native threads (except the main Ruby thread) are
suspended, and GC.start is called

Of course, we need to avoid the situation where a native thread gets a
pointer to a ruby object but before it can dereference it, it loses
its time slice, then we switch to State 2, the GC moves the object, we
switch back to State 1, the thread does the dereference, and CRASH.

We could probably avoid this case by having the native threads call a
certain routine when they want to give up their time slice, and where
that routine is known not to dereference pointers to objects.

I appreciate that what I'm suggesting is a hack, but in part I'm
proposing it simply as a thought experiment to better understand the
issues involved with native threading in the current Ruby interpreter.
Although if some application _really needed_ native threading,
tradeoffs like this might be acceptable.

Wayne Vucenic
No Bugs Software
Ruby and C++ Contract Programming in Silicon Valley
Agile Methods: Test Driven Development, Refactoring, Patterns


djberg96

12/16/2004 3:21:00 PM

0

I've tried tinkering with rb_gc_disable() and rb_gc_start() in various
places in the code but I haven't had any luck. I'm still getting
segfaults.

Feel free to join the win32utils-devel mailing list. I'd be happy to
hear any ideas you have. :)

Regards,

Dan

Anim8rFSK

8/20/2011 9:50:00 PM

0

In article <j2olg6$rp8$1@dont-email.me>, suzeeq <suzee@imbris.com>
wrote:

> Remysun wrote:
> > Breaking Snooze: CBS News' reputation plummets as reporter claims that
> > this weekend's Kardashian wedding could be even bigger than the royal
> > wedding. A $30 million mansion cannot compete against Buckingham
> > Palace. Reality check-- The only way that bridesmaid is ever gonna be
> > bigger than Pippa is at the waist! Because no one could give a crap---
>
> Apparently you do because you posted the same message 6 times....

I only see two, but I see three replies from Ubi ...

--
"Please, I can't die, I've never kissed an Asian woman!"
Shego on "Shat My Dad Says"

suzeeq

8/20/2011 10:49:00 PM

0

Anim8rFSK wrote:
> In article <j2olg6$rp8$1@dont-email.me>, suzeeq <suzee@imbris.com>
> wrote:
>
>> Remysun wrote:
>>> Breaking Snooze: CBS News' reputation plummets as reporter claims that
>>> this weekend's Kardashian wedding could be even bigger than the royal
>>> wedding. A $30 million mansion cannot compete against Buckingham
>>> Palace. Reality check-- The only way that bridesmaid is ever gonna be
>>> bigger than Pippa is at the waist! Because no one could give a crap---
>> Apparently you do because you posted the same message 6 times....
>
> I only see two, but I see three replies from Ubi ...

There were 3 separate threads, but he posted the same thing under two
threads a couple more times... I counted six identical messages.

Anim8rFSK

8/21/2011 1:50:00 AM

0

In article <j2pdk0$kog$1@dont-email.me>, suzeeq <suzee@imbris.com>
wrote:

> Anim8rFSK wrote:
> > In article <j2olg6$rp8$1@dont-email.me>, suzeeq <suzee@imbris.com>
> > wrote:
> >
> >> Remysun wrote:
> >>> Breaking Snooze: CBS News' reputation plummets as reporter claims that
> >>> this weekend's Kardashian wedding could be even bigger than the royal
> >>> wedding. A $30 million mansion cannot compete against Buckingham
> >>> Palace. Reality check-- The only way that bridesmaid is ever gonna be
> >>> bigger than Pippa is at the waist! Because no one could give a crap---
> >> Apparently you do because you posted the same message 6 times....
> >
> > I only see two, but I see three replies from Ubi ...
>
> There were 3 separate threads, but he posted the same thing under two
> threads a couple more times... I counted six identical messages.

Huh. Those didn't show up here. Go figger.

--
"Please, I can't die, I've never kissed an Asian woman!"
Shego on "Shat My Dad Says"