> Typically all of our threaded code is written in C++ and uses the NSPR
> threading primitives (PRLock, PRMonitor, etc). There is currently no
> scriptable access to these primitives, though it wouldn't be hard to provide.
  I've found C++ code for it, and was surprised, that they are not
reflected to XPCOM and XPConnect.

> Using XPCOM on multiple threads through JS (through XPConnect) is not very
> well tested, and the few who venture there ('timeless' on irc) frequently
> find threading bugs.
  It is sad. Intel and AMD sing songs about multicore (read:
"multithreading") programming, and Mozilla (or which word should I use
to name this platform now?) as platfom doesn't provide support for it
;-)
  Ok, "multicore" is buzzword, but many tasks have simple solution with
threads and complex solution with finite state automata or something
like this.

> Typically you would post an event to the main-thread nsIEventQueue.
  How can I do it? I have event queue on hands, of course. How can I
post custom event (with custom name) and how could I register handler
for it (for which object should I call addEventListener())?

> But can I ask what you're using threading for?
  Storage. I'm running very complex SQL queries on big databases, and
don't want UI to lock up and annoying "(not responding)" title appears
(on Windows), etc.

  Please, don't forget: I'm seapking about Mozilla as universal
platform, so here may be many background tasks in applications, not
only networking, but computations, etc. Of course, in every specific
case it is possible to write C++ XPCOM component, which will hide
multithreading from JavaScript glue, like networking code does, but C++
components are not binary-portable and force developer to build project
for any and every platform Mozilla supports or force end-user to has
C++ compiler and be able to build Mozilla (again, I don't know proper
name of PLATFORM) from scratches.

-- 
// Lev Serebryakov

_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to